-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Deferred(DispatchQueue*) #817
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -664,6 +664,39 @@ TEST_F(AutoFilterTest, DeferredDecorateOnly) { | |
ASSERT_EQ(105, dec->i) << "Deferred decorate-only AutoFilter did not properly attach before context termination"; | ||
} | ||
|
||
class DQueueSharedPointer: | ||
public DispatchQueue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tab this one out There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
{ | ||
public: | ||
DQueueSharedPointer(void) | ||
{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove this ctor, too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
size_t callCount = 0; | ||
|
||
Deferred AutoFilter(std::shared_ptr<const int>) { | ||
callCount++; | ||
return Deferred(this); | ||
} | ||
}; | ||
|
||
TEST_F(AutoFilterTest, DQueueAutoFilterTest) { | ||
AutoRequired<AutoPacketFactory> factory; | ||
auto ptr = std::make_shared<int>(1012); | ||
|
||
auto dQueueSharedPtr = AutoRequired<DQueueSharedPointer>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
// Generate a bunch of packets, all with the same shared pointer decoration: | ||
for(size_t i = 0; i < 100; i++) { | ||
// Decorate the packet, forget about it: | ||
auto packet = factory->NewPacket(); | ||
packet->Decorate(ptr); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably want to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the last thing, then I'll merge. |
||
dQueueSharedPtr->DispatchAllEvents(); | ||
|
||
// Ensure nothing got cached unexpectedly, and that the call count is precisely what we want | ||
ASSERT_EQ(100UL, dQueueSharedPtr->callCount) << "The expected number of calls to AutoFilter were not made"; | ||
} | ||
|
||
class MyInheritingAutoFilter: | ||
public FilterGen<std::vector<int>> | ||
{}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this ctor completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done