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

Unified Diff: ipc/ipc_sync_message.cc

Issue 2067233002: Revert of Use Mojo pipes to signal sync IPC events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « ipc/ipc_sync_message.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_message.cc
diff --git a/ipc/ipc_sync_message.cc b/ipc/ipc_sync_message.cc
index ba87de8f22e0b7a426da046b0e36d238ad028c7d..7f9df7bd9bc0187ace28d3595381c431e00b635b 100644
--- a/ipc/ipc_sync_message.cc
+++ b/ipc/ipc_sync_message.cc
@@ -9,10 +9,25 @@
#include <stack>
#include "base/atomic_sequence_num.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
namespace {
+
+struct WaitableEventLazyInstanceTraits
+ : public base::DefaultLazyInstanceTraits<base::WaitableEvent> {
+ static base::WaitableEvent* New(void* instance) {
+ // Use placement new to initialize our instance in our preallocated space.
+ return new (instance)
+ base::WaitableEvent(base::WaitableEvent::ResetPolicy::MANUAL,
+ base::WaitableEvent::InitialState::SIGNALED);
+ }
+};
+
+base::LazyInstance<base::WaitableEvent, WaitableEventLazyInstanceTraits>
+ dummy_event = LAZY_INSTANCE_INITIALIZER;
base::StaticAtomicSequenceNumber g_next_id;
@@ -27,7 +42,8 @@
PriorityValue priority,
MessageReplyDeserializer* deserializer)
: Message(routing_id, type, priority),
- deserializer_(deserializer) {
+ deserializer_(deserializer),
+ pump_messages_event_(NULL) {
set_sync();
set_unblock(true);
@@ -43,6 +59,11 @@
MessageReplyDeserializer* SyncMessage::GetReplyDeserializer() {
DCHECK(deserializer_.get());
return deserializer_.release();
+}
+
+void SyncMessage::EnableMessagePumping() {
+ DCHECK(!pump_messages_event_);
+ set_pump_messages_event(dummy_event.Pointer());
}
bool SyncMessage::IsMessageReplyTo(const Message& msg, int request_id) {
« no previous file with comments | « ipc/ipc_sync_message.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698