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

Unified Diff: ipc/ipc_sync_message_filter.h

Issue 1262253004: Let IPC::SyncMessageFilter take advantage of thread-safe Send. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minus some code Created 5 years, 4 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_channel_unittest.cc ('k') | ipc/ipc_sync_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_message_filter.h
diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h
index 32dffe39d3a4894a34887452769ac329e2cfff3d..2a3c4e89a4c01bad945b7f341f6e0632f9fed1c2 100644
--- a/ipc/ipc_sync_message_filter.h
+++ b/ipc/ipc_sync_message_filter.h
@@ -21,6 +21,7 @@ class WaitableEvent;
}
namespace IPC {
+class SyncChannel;
// This MessageFilter allows sending synchronous IPC messages from a thread
// other than the listener thread associated with the SyncChannel. It does not
@@ -29,8 +30,6 @@ namespace IPC {
// be used to send simultaneous synchronous messages from different threads.
class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
public:
- explicit SyncMessageFilter(base::WaitableEvent* shutdown_event);
-
// MessageSender implementation.
bool Send(Message* message) override;
@@ -41,9 +40,14 @@ class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
bool OnMessageReceived(const Message& message) override;
protected:
+ SyncMessageFilter(base::WaitableEvent* shutdown_event,
+ bool is_channel_send_thread_safe);
+
~SyncMessageFilter() override;
private:
+ friend class SyncChannel;
+
void SendOnIOThread(Message* message);
// Signal all the pending sends as done, used in an error condition.
void SignalAllEvents();
@@ -51,6 +55,9 @@ class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
// The channel to which this filter was added.
Sender* sender_;
+ // Indicates if |sender_|'s Send method is thread-safe.
+ bool is_channel_send_thread_safe_;
+
// The process's main thread.
scoped_refptr<base::SingleThreadTaskRunner> listener_task_runner_;
« no previous file with comments | « ipc/ipc_sync_channel_unittest.cc ('k') | ipc/ipc_sync_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698