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

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

Issue 1403033003: Last set of fixes to make the src/mojo/edk pass the page cycler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes now that OnError can be called multiple times Created 5 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
Index: mojo/edk/system/message_pipe_dispatcher.cc
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index e3bc13b581b24ffba506af2abf4fdfb38c538948..d906aacf5ffc790bfad01762309c7cfe27caff92 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -118,6 +118,8 @@ void MessagePipeDispatcher::Init(
InitOnIO();
}
// TODO(jam): optimize for when running on IO thread?
+ } else {
+ error_ = true;
}
}
@@ -636,6 +638,8 @@ bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock(
serialization->shared_memory_handle_index = platform_handles->size();
platform_handles->push_back(shared_buffer->PassPlatformHandle().release());
+ } else {
+ serialization->shared_memory_handle_index = kInvalidMessagePipeHandleIndex;
}
*actual_size = sizeof(SerializedMessagePipeHandleDispatcher);
@@ -721,6 +725,13 @@ void MessagePipeDispatcher::OnError(Error error) {
error_ = true;
if (started_transport_.Try()) {
base::AutoLock locker(lock());
+ // We can get two OnError callbacks before the post task below completes.
+ // Although RawChannel still has a pointer to this object until Shutdown is
+ // called, that is safe since this class always does a PostTask to the IO
+ // thread to self destruct.
+ if (!channel_)
+ return;
+
awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
base::MessageLoop::current()->PostTask(

Powered by Google App Engine
This is Rietveld 408576698