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.
5 #ifndef CONTENT_CHILD_THREAD_SAFE_SENDER_H_
6 #define CONTENT_CHILD_THREAD_SAFE_SENDER_H_
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h"
11 #include "ipc/ipc_sender.h"
14 class MessageLoopProxy
;
18 class SyncMessageFilter
;
22 class ChildThreadImpl
;
24 // The class of Sender returned by ChildThreadImpl::thread_safe_sender().
25 class CONTENT_EXPORT ThreadSafeSender
27 public base::RefCountedThreadSafe
<ThreadSafeSender
> {
29 bool Send(IPC::Message
* msg
) override
;
32 ThreadSafeSender(const scoped_refptr
<base::MessageLoopProxy
>& main_loop
,
33 const scoped_refptr
<IPC::SyncMessageFilter
>& sync_filter
);
34 ~ThreadSafeSender() override
;
37 friend class ChildThreadImpl
; // for construction
38 friend class IndexedDBDispatcherTest
;
39 friend class WebIDBCursorImplTest
;
40 friend class base::RefCountedThreadSafe
<ThreadSafeSender
>;
42 scoped_refptr
<base::MessageLoopProxy
> main_loop_
;
43 scoped_refptr
<IPC::SyncMessageFilter
> sync_filter_
;
45 DISALLOW_COPY_AND_ASSIGN(ThreadSafeSender
);
48 } // namespace content
50 #endif // CONTENT_CHILD_THREAD_SAFE_SENDER_H_