| 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> |
| 8 #include <set> | 9 #include <set> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "ipc/ipc_sender.h" | 15 #include "ipc/ipc_sender.h" |
| 15 #include "ipc/ipc_sync_message.h" | 16 #include "ipc/ipc_sync_message.h" |
| 16 #include "ipc/message_filter.h" | 17 #include "ipc/message_filter.h" |
| 17 | 18 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 public: | 33 public: |
| 33 // MessageSender implementation. | 34 // MessageSender implementation. |
| 34 bool Send(Message* message) override; | 35 bool Send(Message* message) override; |
| 35 | 36 |
| 36 // MessageFilter implementation. | 37 // MessageFilter implementation. |
| 37 void OnFilterAdded(Sender* sender) override; | 38 void OnFilterAdded(Sender* sender) override; |
| 38 void OnChannelError() override; | 39 void OnChannelError() override; |
| 39 void OnChannelClosing() override; | 40 void OnChannelClosing() override; |
| 40 bool OnMessageReceived(const Message& message) override; | 41 bool OnMessageReceived(const Message& message) override; |
| 41 | 42 |
| 43 // Like Send but may send immediately (instead of posting to the IPC thread) |
| 44 // if the underlying Channel implements a thread-safe Send. |
| 45 bool SendNow(std::unique_ptr<Message> message); |
| 46 |
| 42 protected: | 47 protected: |
| 43 SyncMessageFilter(base::WaitableEvent* shutdown_event, | 48 SyncMessageFilter(base::WaitableEvent* shutdown_event, |
| 44 bool is_channel_send_thread_safe); | 49 bool is_channel_send_thread_safe); |
| 45 | 50 |
| 46 ~SyncMessageFilter() override; | 51 ~SyncMessageFilter() override; |
| 47 | 52 |
| 48 private: | 53 private: |
| 49 friend class SyncChannel; | 54 friend class SyncChannel; |
| 50 | 55 |
| 51 void set_is_channel_send_thread_safe(bool is_channel_send_thread_safe) { | 56 void set_is_channel_send_thread_safe(bool is_channel_send_thread_safe) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 base::Lock lock_; | 83 base::Lock lock_; |
| 79 | 84 |
| 80 base::WaitableEvent* shutdown_event_; | 85 base::WaitableEvent* shutdown_event_; |
| 81 | 86 |
| 82 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter); | 87 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter); |
| 83 }; | 88 }; |
| 84 | 89 |
| 85 } // namespace IPC | 90 } // namespace IPC |
| 86 | 91 |
| 87 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_ | 92 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_ |
| OLD | NEW |