Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Unified Diff: mojo/edk/system/test_channel_endpoint_client.cc

Issue 1153283004: Make TestChannelEndpointClient use MessageInTransitQueue. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/test_channel_endpoint_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/test_channel_endpoint_client.cc
diff --git a/mojo/edk/system/test_channel_endpoint_client.cc b/mojo/edk/system/test_channel_endpoint_client.cc
index 7698bf21811c70453d592d620da065f79d7dbd3d..51d2a5806a6fc9589fbe2eeceb5b83fcca0a98f6 100644
--- a/mojo/edk/system/test_channel_endpoint_client.cc
+++ b/mojo/edk/system/test_channel_endpoint_client.cc
@@ -31,16 +31,14 @@ bool TestChannelEndpointClient::IsDetached() const {
size_t TestChannelEndpointClient::NumMessages() const {
base::AutoLock locker(lock_);
- return messages_.size();
+ return messages_.Size();
}
scoped_ptr<MessageInTransit> TestChannelEndpointClient::PopMessage() {
base::AutoLock locker(lock_);
- if (!messages_.size())
+ if (messages_.IsEmpty())
return nullptr;
- scoped_ptr<MessageInTransit> rv(messages_.front());
- messages_.pop_front();
- return rv;
+ return messages_.GetMessage();
}
void TestChannelEndpointClient::SetReadEvent(base::WaitableEvent* read_event) {
@@ -54,7 +52,7 @@ bool TestChannelEndpointClient::OnReadMessage(unsigned port,
EXPECT_EQ(port_, port);
EXPECT_TRUE(endpoint_);
- messages_.push_back(message);
+ messages_.AddMessage(make_scoped_ptr(message));
if (read_event_)
read_event_->Signal();
@@ -73,8 +71,6 @@ void TestChannelEndpointClient::OnDetachFromChannel(unsigned port) {
TestChannelEndpointClient::~TestChannelEndpointClient() {
EXPECT_FALSE(endpoint_);
- for (auto message : messages_)
- delete message;
}
} // namespace test
« no previous file with comments | « mojo/edk/system/test_channel_endpoint_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698