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

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

Issue 694923002: Update mojo sdk to rev 91d94d6993c9b0c4135a95687a7d541ce90629b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/channel_endpoint.h ('k') | mojo/edk/system/message_pipe.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/channel_endpoint.cc
diff --git a/mojo/edk/system/channel_endpoint.cc b/mojo/edk/system/channel_endpoint.cc
index ac2005603ee8a26d182637f6037c5c6e27d972de..8b646431e192ad3315e1462b52ce5b45220a64a2 100644
--- a/mojo/edk/system/channel_endpoint.cc
+++ b/mojo/edk/system/channel_endpoint.cc
@@ -12,15 +12,15 @@
namespace mojo {
namespace system {
-ChannelEndpoint::ChannelEndpoint(MessagePipe* message_pipe, unsigned port)
+ChannelEndpoint::ChannelEndpoint(MessagePipe* message_pipe,
+ unsigned port,
+ MessageInTransitQueue* message_queue)
: message_pipe_(message_pipe), port_(port), channel_(nullptr) {
- DCHECK(message_pipe_.get());
+ DCHECK(message_pipe_.get() || message_queue);
DCHECK(port_ == 0 || port_ == 1);
-}
-void ChannelEndpoint::TakeMessages(MessageInTransitQueue* message_queue) {
- DCHECK(paused_message_queue_.IsEmpty());
- paused_message_queue_.Swap(message_queue);
+ if (message_queue)
+ paused_message_queue_.Swap(message_queue);
}
bool ChannelEndpoint::EnqueueMessage(scoped_ptr<MessageInTransit> message) {
@@ -45,9 +45,6 @@ bool ChannelEndpoint::EnqueueMessage(scoped_ptr<MessageInTransit> message) {
}
void ChannelEndpoint::DetachFromMessagePipe() {
- // TODO(vtl): Once |message_pipe_| is under |lock_|, we should null it out
- // here. For now, get the channel to do so for us.
-
{
base::AutoLock locker(lock_);
DCHECK(message_pipe_.get());
@@ -84,6 +81,13 @@ void ChannelEndpoint::AttachAndRun(Channel* channel,
LOG_IF(WARNING, !WriteMessageNoLock(paused_message_queue_.GetMessage()))
<< "Failed to write enqueue message to channel";
}
+
+ if (!message_pipe_.get()) {
+ channel_->DetachEndpoint(this, local_id_, remote_id_);
+ channel_ = nullptr;
+ local_id_ = ChannelEndpointId();
+ remote_id_ = ChannelEndpointId();
+ }
}
bool ChannelEndpoint::OnReadMessage(
« no previous file with comments | « mojo/edk/system/channel_endpoint.h ('k') | mojo/edk/system/message_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698