OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_CHILD_THREAD_SAFE_SENDER_H_ | 5 #ifndef CONTENT_CHILD_THREAD_SAFE_SENDER_H_ |
6 #define CONTENT_CHILD_THREAD_SAFE_SENDER_H_ | 6 #define CONTENT_CHILD_THREAD_SAFE_SENDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "ipc/ipc_sender.h" | 11 #include "ipc/ipc_sender.h" |
| 12 #include "ipc/ipc_sync_message_filter.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
15 } | 16 } |
16 | 17 |
17 namespace IPC { | |
18 class SyncMessageFilter; | |
19 } | |
20 | |
21 namespace content { | 18 namespace content { |
22 class ChildThreadImpl; | 19 class ChildThreadImpl; |
23 | 20 |
24 // The class of Sender returned by ChildThreadImpl::thread_safe_sender(). | 21 // The class of Sender returned by ChildThreadImpl::thread_safe_sender(). |
25 class CONTENT_EXPORT ThreadSafeSender | 22 class CONTENT_EXPORT ThreadSafeSender |
26 : public IPC::Sender, | 23 : public IPC::Sender, |
27 public base::RefCountedThreadSafe<ThreadSafeSender> { | 24 public base::RefCountedThreadSafe<ThreadSafeSender> { |
28 public: | 25 public: |
29 bool Send(IPC::Message* msg) override; | 26 bool Send(IPC::Message* msg) override; |
30 | 27 |
| 28 scoped_refptr<IPC::SyncMessageFilter> sync_filter() const { |
| 29 return sync_filter_; |
| 30 } |
| 31 |
31 protected: | 32 protected: |
32 ThreadSafeSender( | 33 ThreadSafeSender( |
33 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, | 34 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
34 const scoped_refptr<IPC::SyncMessageFilter>& sync_filter); | 35 const scoped_refptr<IPC::SyncMessageFilter>& sync_filter); |
35 ~ThreadSafeSender() override; | 36 ~ThreadSafeSender() override; |
36 | 37 |
37 private: | 38 private: |
38 friend class ChildThreadImpl; // for construction | 39 friend class ChildThreadImpl; // for construction |
39 friend class IndexedDBDispatcherTest; | 40 friend class IndexedDBDispatcherTest; |
40 friend class WebIDBCursorImplTest; | 41 friend class WebIDBCursorImplTest; |
41 friend class base::RefCountedThreadSafe<ThreadSafeSender>; | 42 friend class base::RefCountedThreadSafe<ThreadSafeSender>; |
42 | 43 |
43 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 44 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
44 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 45 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(ThreadSafeSender); | 47 DISALLOW_COPY_AND_ASSIGN(ThreadSafeSender); |
47 }; | 48 }; |
48 | 49 |
49 } // namespace content | 50 } // namespace content |
50 | 51 |
51 #endif // CONTENT_CHILD_THREAD_SAFE_SENDER_H_ | 52 #endif // CONTENT_CHILD_THREAD_SAFE_SENDER_H_ |
OLD | NEW |