Index: ipc/mojo/ipc_channel_mojo.h |
diff --git a/ipc/mojo/ipc_channel_mojo.h b/ipc/mojo/ipc_channel_mojo.h |
index 1ef32c6bf2704e7f796b77dcdd2bff3b648662e8..db4277e70b66ee9737a1d052165db7c268483d4c 100644 |
--- a/ipc/mojo/ipc_channel_mojo.h |
+++ b/ipc/mojo/ipc_channel_mojo.h |
@@ -10,6 +10,7 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/synchronization/lock.h" |
#include "ipc/ipc_channel.h" |
#include "ipc/ipc_channel_factory.h" |
#include "ipc/ipc_export.h" |
@@ -86,6 +87,7 @@ class IPC_MOJO_EXPORT ChannelMojo |
bool Connect() override; |
void Close() override; |
bool Send(Message* message) override; |
+ bool IsSendThreadSafe() const override; |
base::ProcessId GetPeerPID() const override; |
base::ProcessId GetSelfPID() const override; |
@@ -135,15 +137,22 @@ class IPC_MOJO_EXPORT ChannelMojo |
typedef internal::MessagePipeReader::DelayedDeleter ReaderDeleter; |
void InitDelegate(ChannelMojo::Delegate* delegate); |
+ base::TaskRunner* GetIOTaskRunner(); |
scoped_ptr<MojoBootstrap> bootstrap_; |
- base::WeakPtr<Delegate> delegate_; |
Mode mode_; |
Listener* listener_; |
base::ProcessId peer_pid_; |
scoped_ptr<mojo::embedder::ChannelInfo, |
ChannelInfoDeleter> channel_info_; |
+ // Guards |message_reader_|, |pending_messages_| and |delegate_|. |
+ // |
+ // * The contents of |pending_messages_| can be modified from any threads. |
+ // * |delegate_| and |message_reader_| is modified only from IO thread, |
+ // but they can be referred from other threads. |
+ base::Lock lock_; |
+ base::WeakPtr<Delegate> delegate_; |
scoped_ptr<internal::MessagePipeReader, ReaderDeleter> message_reader_; |
ScopedVector<Message> pending_messages_; |