| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
| 17 #include "ipc/ipc_channel_handle.h" |
| 17 #include "ipc/ipc_listener.h" | 18 #include "ipc/ipc_listener.h" |
| 18 #include "ipc/ipc_platform_file.h" | 19 #include "ipc/ipc_platform_file.h" |
| 19 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
| 20 #include "ppapi/c/pp_instance.h" | 21 #include "ppapi/c/pp_instance.h" |
| 21 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" | 22 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" |
| 22 #include "ppapi/proxy/connection.h" | 23 #include "ppapi/proxy/connection.h" |
| 23 #include "ppapi/proxy/plugin_dispatcher.h" | 24 #include "ppapi/proxy/plugin_dispatcher.h" |
| 24 #include "ppapi/proxy/plugin_proxy_delegate.h" | 25 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 25 | 26 |
| 26 struct PP_BrowserFont_Trusted_Description; | 27 struct PP_BrowserFont_Trusted_Description; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 // This class manages communication between the plugin and the browser, and | 44 // This class manages communication between the plugin and the browser, and |
| 44 // manages the PluginDispatcher instances for communication between the plugin | 45 // manages the PluginDispatcher instances for communication between the plugin |
| 45 // and the renderer. | 46 // and the renderer. |
| 46 class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate, | 47 class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate, |
| 47 public proxy::PluginProxyDelegate, | 48 public proxy::PluginProxyDelegate, |
| 48 public IPC::Listener, | 49 public IPC::Listener, |
| 49 public IPC::Sender { | 50 public IPC::Sender { |
| 50 public: | 51 public: |
| 51 PpapiDispatcher(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 52 PpapiDispatcher(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 52 base::WaitableEvent* shutdown_event, | 53 base::WaitableEvent* shutdown_event, |
| 53 int browser_ipc_fd, | 54 IPC::ChannelHandle browser_ipc_handle, |
| 54 int renderer_ipc_fd); | 55 IPC::ChannelHandle renderer_ipc_handle); |
| 55 | 56 |
| 56 // PluginDispatcher::PluginDelegate implementation. | 57 // PluginDispatcher::PluginDelegate implementation. |
| 57 base::SingleThreadTaskRunner* GetIPCTaskRunner() override; | 58 base::SingleThreadTaskRunner* GetIPCTaskRunner() override; |
| 58 base::WaitableEvent* GetShutdownEvent() override; | 59 base::WaitableEvent* GetShutdownEvent() override; |
| 59 IPC::PlatformFileForTransit ShareHandleWithRemote( | 60 IPC::PlatformFileForTransit ShareHandleWithRemote( |
| 60 base::PlatformFile handle, | 61 base::PlatformFile handle, |
| 61 base::ProcessId peer_pid, | 62 base::ProcessId peer_pid, |
| 62 bool should_close_source) override; | 63 bool should_close_source) override; |
| 63 base::SharedMemoryHandle ShareSharedMemoryHandleWithRemote( | 64 base::SharedMemoryHandle ShareSharedMemoryHandleWithRemote( |
| 64 const base::SharedMemoryHandle& handle, | 65 const base::SharedMemoryHandle& handle, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 87 private: | 88 private: |
| 88 void OnMsgInitializeNaClDispatcher(const PpapiNaClPluginArgs& args); | 89 void OnMsgInitializeNaClDispatcher(const PpapiNaClPluginArgs& args); |
| 89 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); | 90 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); |
| 90 | 91 |
| 91 std::set<PP_Instance> instances_; | 92 std::set<PP_Instance> instances_; |
| 92 std::map<uint32_t, proxy::PluginDispatcher*> plugin_dispatchers_; | 93 std::map<uint32_t, proxy::PluginDispatcher*> plugin_dispatchers_; |
| 93 uint32_t next_plugin_dispatcher_id_; | 94 uint32_t next_plugin_dispatcher_id_; |
| 94 | 95 |
| 95 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 96 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 96 base::WaitableEvent* shutdown_event_; | 97 base::WaitableEvent* shutdown_event_; |
| 97 int renderer_ipc_fd_; | 98 IPC::ChannelHandle renderer_ipc_handle_; |
| 98 std::unique_ptr<IPC::SyncChannel> channel_; | 99 std::unique_ptr<IPC::SyncChannel> channel_; |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace ppapi | 102 } // namespace ppapi |
| 102 | 103 |
| 103 #endif // PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ | 104 #endif // PPAPI_NACL_IRT_PPAPI_DISPATCHER_H_ |
| OLD | NEW |