| OLD | NEW |
| 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 <memory> | |
| 9 #include <set> | 8 #include <set> |
| 10 #include <vector> | 9 #include <vector> |
| 11 | 10 |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 14 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 15 #include "base/synchronization/waitable_event_watcher.h" | 14 #include "base/synchronization/waitable_event_watcher.h" |
| 16 #include "ipc/ipc_sender.h" | 15 #include "ipc/ipc_sender.h" |
| 17 #include "ipc/ipc_sync_message.h" | 16 #include "ipc/ipc_sync_message.h" |
| 18 #include "ipc/message_filter.h" | 17 #include "ipc/message_filter.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 public: | 34 public: |
| 36 // MessageSender implementation. | 35 // MessageSender implementation. |
| 37 bool Send(Message* message) override; | 36 bool Send(Message* message) override; |
| 38 | 37 |
| 39 // MessageFilter implementation. | 38 // MessageFilter implementation. |
| 40 void OnFilterAdded(Sender* sender) override; | 39 void OnFilterAdded(Sender* sender) override; |
| 41 void OnChannelError() override; | 40 void OnChannelError() override; |
| 42 void OnChannelClosing() override; | 41 void OnChannelClosing() override; |
| 43 bool OnMessageReceived(const Message& message) override; | 42 bool OnMessageReceived(const Message& message) override; |
| 44 | 43 |
| 45 // Like Send but may send immediately (instead of posting to the IPC thread) | |
| 46 // if the underlying Channel implements a thread-safe Send. | |
| 47 bool SendNow(std::unique_ptr<Message> message); | |
| 48 | |
| 49 protected: | 44 protected: |
| 50 SyncMessageFilter(base::WaitableEvent* shutdown_event, | 45 SyncMessageFilter(base::WaitableEvent* shutdown_event, |
| 51 bool is_channel_send_thread_safe); | 46 bool is_channel_send_thread_safe); |
| 52 | 47 |
| 53 ~SyncMessageFilter() override; | 48 ~SyncMessageFilter() override; |
| 54 | 49 |
| 55 private: | 50 private: |
| 56 friend class SyncChannel; | 51 friend class SyncChannel; |
| 57 | 52 |
| 58 void set_is_channel_send_thread_safe(bool is_channel_send_thread_safe) { | 53 void set_is_channel_send_thread_safe(bool is_channel_send_thread_safe) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // A Mojo event which can be watched for shutdown. Signals are forwarded to | 90 // A Mojo event which can be watched for shutdown. Signals are forwarded to |
| 96 // this event asynchronously from |shutdown_event_|. | 91 // this event asynchronously from |shutdown_event_|. |
| 97 MojoEvent shutdown_mojo_event_; | 92 MojoEvent shutdown_mojo_event_; |
| 98 | 93 |
| 99 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter); | 94 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter); |
| 100 }; | 95 }; |
| 101 | 96 |
| 102 } // namespace IPC | 97 } // namespace IPC |
| 103 | 98 |
| 104 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_ | 99 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_ |
| OLD | NEW |