OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_THREAD_SAFE_SENDER_H_ | |
6 #define CONTENT_COMMON_THREAD_SAFE_SENDER_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "ipc/ipc_sender.h" | |
10 | |
11 namespace base { | |
12 class MessageLoopProxy; | |
13 } | |
14 | |
15 namespace IPC { | |
16 class SyncMessageFilter; | |
17 } | |
18 | |
19 namespace content { | |
20 class ChildThread; | |
21 | |
22 // The class of Sender returned by ChildThread::thread_safe_sender(). | |
23 class ThreadSafeSender | |
24 : public IPC::Sender, | |
25 public base::RefCountedThreadSafe<ThreadSafeSender> { | |
26 public: | |
27 virtual bool Send(IPC::Message* msg) OVERRIDE; | |
28 | |
29 private: | |
30 friend class ChildThread; // for construction | |
31 friend class base::RefCountedThreadSafe<ThreadSafeSender>; | |
32 | |
33 ThreadSafeSender(base::MessageLoopProxy* main_loop, | |
34 IPC::SyncMessageFilter* sync_filter); | |
35 virtual ~ThreadSafeSender(); | |
36 | |
37 scoped_refptr<base::MessageLoopProxy> main_loop_; | |
38 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(ThreadSafeSender); | |
41 }; | |
42 | |
43 } // namespace content | |
44 | |
45 #endif // CONTENT_COMMON_THREAD_SAFE_SENDER_H_ | |
OLD | NEW |