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

Side by Side Diff: ipc/ipc_sync_message_filter.h

Issue 2349713003: IPC::MessageFilter::OnFilterAdded: IPC::Sender -> IPC::Channel (Closed)
Patch Set: . Created 4 years, 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IPC_IPC_SYNC_MESSAGE_FILTER_H_ 5 #ifndef IPC_IPC_SYNC_MESSAGE_FILTER_H_
6 #define IPC_IPC_SYNC_MESSAGE_FILTER_H_ 6 #define IPC_IPC_SYNC_MESSAGE_FILTER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 namespace IPC { 26 namespace IPC {
27 class SyncChannel; 27 class SyncChannel;
28 28
29 // This MessageFilter allows sending synchronous IPC messages from a thread 29 // This MessageFilter allows sending synchronous IPC messages from a thread
30 // other than the listener thread associated with the SyncChannel. It does not 30 // other than the listener thread associated with the SyncChannel. It does not
31 // support fancy features that SyncChannel does, such as handling recursion or 31 // support fancy features that SyncChannel does, such as handling recursion or
32 // receiving messages while waiting for a response. Note that this object can 32 // receiving messages while waiting for a response. Note that this object can
33 // be used to send simultaneous synchronous messages from different threads. 33 // be used to send simultaneous synchronous messages from different threads.
34 class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender { 34 class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender {
35 public: 35 public:
36 // MessageSender implementation. 36 // Sender implementation.
37 bool Send(Message* message) override; 37 bool Send(Message* message) override;
38 38
39 // MessageFilter implementation. 39 // MessageFilter implementation.
40 void OnFilterAdded(Sender* sender) override; 40 void OnFilterAdded(Channel* channel) override;
41 void OnChannelError() override; 41 void OnChannelError() override;
42 void OnChannelClosing() override; 42 void OnChannelClosing() override;
43 bool OnMessageReceived(const Message& message) override; 43 bool OnMessageReceived(const Message& message) override;
44 44
45 protected: 45 protected:
46 explicit SyncMessageFilter(base::WaitableEvent* shutdown_event); 46 explicit SyncMessageFilter(base::WaitableEvent* shutdown_event);
47 ~SyncMessageFilter() override; 47 ~SyncMessageFilter() override;
48 48
49 private: 49 private:
50 class IOMessageLoopObserver; 50 class IOMessageLoopObserver;
51 51
52 friend class SyncChannel; 52 friend class SyncChannel;
53 friend class IOMessageLoopObserver; 53 friend class IOMessageLoopObserver;
54 54
55 void SendOnIOThread(Message* message); 55 void SendOnIOThread(Message* message);
56 // Signal all the pending sends as done, used in an error condition. 56 // Signal all the pending sends as done, used in an error condition.
57 void SignalAllEvents(); 57 void SignalAllEvents();
58 58
59 void OnShutdownEventSignaled(base::WaitableEvent* event); 59 void OnShutdownEventSignaled(base::WaitableEvent* event);
60 void OnIOMessageLoopDestroyed(); 60 void OnIOMessageLoopDestroyed();
61 61
62 // The channel to which this filter was added. 62 // The channel to which this filter was added.
63 Sender* sender_; 63 Channel* channel_;
64 64
65 // The process's main thread. 65 // The process's main thread.
66 scoped_refptr<base::SingleThreadTaskRunner> listener_task_runner_; 66 scoped_refptr<base::SingleThreadTaskRunner> listener_task_runner_;
67 67
68 // The message loop where the Channel lives. 68 // The message loop where the Channel lives.
69 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 69 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
70 70
71 typedef std::set<PendingSyncMsg*> PendingSyncMessages; 71 typedef std::set<PendingSyncMsg*> PendingSyncMessages;
72 PendingSyncMessages pending_sync_messages_; 72 PendingSyncMessages pending_sync_messages_;
73 73
(...skipping 16 matching lines...) Expand all
90 scoped_refptr<IOMessageLoopObserver> io_message_loop_observer_; 90 scoped_refptr<IOMessageLoopObserver> io_message_loop_observer_;
91 91
92 base::WeakPtrFactory<SyncMessageFilter> weak_factory_; 92 base::WeakPtrFactory<SyncMessageFilter> weak_factory_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter); 94 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter);
95 }; 95 };
96 96
97 } // namespace IPC 97 } // namespace IPC
98 98
99 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_ 99 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_
OLDNEW
« 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