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

Unified Diff: mojo/edk/system/data_pipe_producer_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/data_pipe_producer_dispatcher.cc
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index 3a579c8ec35d7a7f6b95671a588708475ce80d66..c9d0da682be6b2d5ecb85da200d851e13ff6b2f2 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -25,6 +25,8 @@ void DataPipeProducerDispatcher::Init(
nullptr, 0u, serialized_write_buffer, serialized_write_buffer_size);
internal::g_io_thread_task_runner->PostTask(
FROM_HERE, base::Bind(&DataPipeProducerDispatcher::InitOnIO, this));
+ } else {
+ error_ = true;
}
}
@@ -72,10 +74,8 @@ DataPipeProducerDispatcher::Deserialize(
serialized_write_buffer_size = shared_memory_size;
}
- if (platform_handle.is_valid()) {
- rv->Init(platform_handle.Pass(), serialized_write_buffer,
- serialized_write_buffer_size);
- }
+ rv->Init(platform_handle.Pass(), serialized_write_buffer,
+ serialized_write_buffer_size);
return rv;
}
@@ -334,6 +334,13 @@ void DataPipeProducerDispatcher::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