OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ | 5 #ifndef PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ |
6 #define PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ | 6 #define PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_platform_file.h" | 16 #include "ipc/ipc_platform_file.h" |
17 #include "ipc/ipc_sender.h" | 17 #include "ipc/ipc_sender.h" |
18 #include "ppapi/c/pp_instance.h" | 18 #include "ppapi/c/pp_instance.h" |
19 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" | 19 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" |
20 #include "ppapi/proxy/connection.h" | 20 #include "ppapi/proxy/connection.h" |
21 #include "ppapi/proxy/plugin_dispatcher.h" | 21 #include "ppapi/proxy/plugin_dispatcher.h" |
22 #include "ppapi/proxy/plugin_proxy_delegate.h" | 22 #include "ppapi/proxy/plugin_proxy_delegate.h" |
23 | 23 |
24 struct PP_BrowserFont_Trusted_Description; | 24 struct PP_BrowserFont_Trusted_Description; |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class MessageLoopProxy; | 27 class SingleThreadTaskRunner; |
28 class WaitableEvent; | 28 class WaitableEvent; |
29 } // namespace base | 29 } // namespace base |
30 | 30 |
31 namespace IPC { | 31 namespace IPC { |
32 class Message; | 32 class Message; |
33 class SyncChannel; | 33 class SyncChannel; |
34 } // namespace IPC | 34 } // namespace IPC |
35 | 35 |
36 namespace ppapi { | 36 namespace ppapi { |
37 | 37 |
38 struct PpapiNaClPluginArgs; | 38 struct PpapiNaClPluginArgs; |
39 struct Preferences; | 39 struct Preferences; |
40 | 40 |
41 // This class manages communication between the plugin and the browser, and | 41 // This class manages communication between the plugin and the browser, and |
42 // manages the PluginDispatcher instances for communication between the plugin | 42 // manages the PluginDispatcher instances for communication between the plugin |
43 // and the renderer. | 43 // and the renderer. |
44 class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate, | 44 class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate, |
45 public proxy::PluginProxyDelegate, | 45 public proxy::PluginProxyDelegate, |
46 public IPC::Listener, | 46 public IPC::Listener, |
47 public IPC::Sender { | 47 public IPC::Sender { |
48 public: | 48 public: |
49 PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop, | 49 PpapiDispatcher(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
50 base::WaitableEvent* shutdown_event, | 50 base::WaitableEvent* shutdown_event, |
51 int browser_ipc_fd, | 51 int browser_ipc_fd, |
52 int renderer_ipc_fd); | 52 int renderer_ipc_fd); |
53 | 53 |
54 // PluginDispatcher::PluginDelegate implementation. | 54 // PluginDispatcher::PluginDelegate implementation. |
55 base::SingleThreadTaskRunner* GetIPCTaskRunner() override; | 55 base::SingleThreadTaskRunner* GetIPCTaskRunner() override; |
56 base::WaitableEvent* GetShutdownEvent() override; | 56 base::WaitableEvent* GetShutdownEvent() override; |
57 IPC::PlatformFileForTransit ShareHandleWithRemote( | 57 IPC::PlatformFileForTransit ShareHandleWithRemote( |
58 base::PlatformFile handle, | 58 base::PlatformFile handle, |
59 base::ProcessId peer_pid, | 59 base::ProcessId peer_pid, |
(...skipping 23 matching lines...) Expand all Loading... |
83 bool Send(IPC::Message* message) override; | 83 bool Send(IPC::Message* message) override; |
84 | 84 |
85 private: | 85 private: |
86 void OnMsgInitializeNaClDispatcher(const PpapiNaClPluginArgs& args); | 86 void OnMsgInitializeNaClDispatcher(const PpapiNaClPluginArgs& args); |
87 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); | 87 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); |
88 | 88 |
89 std::set<PP_Instance> instances_; | 89 std::set<PP_Instance> instances_; |
90 std::map<uint32, proxy::PluginDispatcher*> plugin_dispatchers_; | 90 std::map<uint32, proxy::PluginDispatcher*> plugin_dispatchers_; |
91 uint32 next_plugin_dispatcher_id_; | 91 uint32 next_plugin_dispatcher_id_; |
92 | 92 |
93 scoped_refptr<base::MessageLoopProxy> message_loop_; | 93 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
94 base::WaitableEvent* shutdown_event_; | 94 base::WaitableEvent* shutdown_event_; |
95 int renderer_ipc_fd_; | 95 int renderer_ipc_fd_; |
96 scoped_ptr<IPC::SyncChannel> channel_; | 96 scoped_ptr<IPC::SyncChannel> channel_; |
97 }; | 97 }; |
98 | 98 |
99 } // namespace ppapi | 99 } // namespace ppapi |
100 | 100 |
101 #endif // PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ | 101 #endif // PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ |
OLD | NEW |