| 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/gtest_prod_util.h" |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" |
| 9 #include "ipc/ipc_sender.h" | 11 #include "ipc/ipc_sender.h" |
| 10 | 12 |
| 11 namespace base { | 13 namespace base { |
| 12 class MessageLoopProxy; | 14 class MessageLoopProxy; |
| 13 } | 15 } |
| 14 | 16 |
| 15 namespace IPC { | 17 namespace IPC { |
| 16 class SyncMessageFilter; | 18 class SyncMessageFilter; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 20 class ChildThread; | 22 class ChildThread; |
| 21 | 23 |
| 22 // The class of Sender returned by ChildThread::thread_safe_sender(). | 24 // The class of Sender returned by ChildThread::thread_safe_sender(). |
| 23 class ThreadSafeSender | 25 class CONTENT_EXPORT ThreadSafeSender |
| 24 : public IPC::Sender, | 26 : public IPC::Sender, |
| 25 public base::RefCountedThreadSafe<ThreadSafeSender> { | 27 public base::RefCountedThreadSafe<ThreadSafeSender> { |
| 26 public: | 28 public: |
| 27 virtual bool Send(IPC::Message* msg) OVERRIDE; | 29 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 friend class ChildThread; // for construction | 32 friend class ChildThread; // for construction |
| 31 friend class base::RefCountedThreadSafe<ThreadSafeSender>; | 33 friend class base::RefCountedThreadSafe<ThreadSafeSender>; |
| 34 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); |
| 35 FRIEND_TEST_ALL_PREFIXES(RendererWebIDBCursorImplTest, PrefetchTest); |
| 32 | 36 |
| 33 ThreadSafeSender(base::MessageLoopProxy* main_loop, | 37 ThreadSafeSender(base::MessageLoopProxy* main_loop, |
| 34 IPC::SyncMessageFilter* sync_filter); | 38 IPC::SyncMessageFilter* sync_filter); |
| 35 virtual ~ThreadSafeSender(); | 39 virtual ~ThreadSafeSender(); |
| 36 | 40 |
| 37 scoped_refptr<base::MessageLoopProxy> main_loop_; | 41 scoped_refptr<base::MessageLoopProxy> main_loop_; |
| 38 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 42 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
| 39 | 43 |
| 40 DISALLOW_COPY_AND_ASSIGN(ThreadSafeSender); | 44 DISALLOW_COPY_AND_ASSIGN(ThreadSafeSender); |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 } // namespace content | 47 } // namespace content |
| 44 | 48 |
| 45 #endif // CONTENT_CHILD_THREAD_SAFE_SENDER_H_ | 49 #endif // CONTENT_CHILD_THREAD_SAFE_SENDER_H_ |
| OLD | NEW |