| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 5 #ifndef CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| 6 #define CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 6 #define CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 33 class PpapiThread : public ChildThread, | 33 class PpapiThread : public ChildThread, |
| 34 public ppapi::proxy::PluginDispatcher::PluginDelegate, | 34 public ppapi::proxy::PluginDispatcher::PluginDelegate, |
| 35 public ppapi::proxy::PluginProxyDelegate { | 35 public ppapi::proxy::PluginProxyDelegate { |
| 36 public: | 36 public: |
| 37 PpapiThread(const CommandLine& command_line, bool is_broker); | 37 PpapiThread(const CommandLine& command_line, bool is_broker); |
| 38 virtual ~PpapiThread(); | 38 virtual ~PpapiThread(); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // ChildThread overrides. | 41 // ChildThread overrides. |
| 42 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 42 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 43 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 43 | 44 |
| 44 // PluginDispatcher::PluginDelegate implementation. | 45 // PluginDispatcher::PluginDelegate implementation. |
| 45 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() OVERRIDE; | 46 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() OVERRIDE; |
| 46 virtual base::MessageLoopProxy* GetIPCMessageLoop() OVERRIDE; | 47 virtual base::MessageLoopProxy* GetIPCMessageLoop() OVERRIDE; |
| 47 virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE; | 48 virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE; |
| 49 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( |
| 50 base::PlatformFile handle, |
| 51 const IPC::SyncChannel& channel, |
| 52 bool should_close_source) OVERRIDE; |
| 48 virtual uint32 Register( | 53 virtual uint32 Register( |
| 49 ppapi::proxy::PluginDispatcher* plugin_dispatcher) OVERRIDE; | 54 ppapi::proxy::PluginDispatcher* plugin_dispatcher) OVERRIDE; |
| 50 virtual void Unregister(uint32 plugin_dispatcher_id) OVERRIDE; | 55 virtual void Unregister(uint32 plugin_dispatcher_id) OVERRIDE; |
| 51 | 56 |
| 52 // PluginProxyDelegate. | 57 // PluginProxyDelegate. |
| 53 virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE; | 58 virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE; |
| 54 virtual void PreCacheFont(const void* logfontw) OVERRIDE; | 59 virtual void PreCacheFont(const void* logfontw) OVERRIDE; |
| 55 | 60 |
| 56 // Message handlers. | 61 // Message handlers. |
| 57 void OnMsgLoadPlugin(const FilePath& path); | 62 void OnMsgLoadPlugin(const FilePath& path); |
| 58 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, | 63 void OnMsgCreateChannel(int renderer_id, |
| 59 int renderer_id, | |
| 60 bool incognito); | 64 bool incognito); |
| 61 void OnMsgSetNetworkState(bool online); | 65 void OnMsgSetNetworkState(bool online); |
| 62 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); | 66 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); |
| 63 | 67 |
| 64 // Sets up the channel to the given renderer. On success, returns true and | 68 // Sets up the channel to the given renderer. On success, returns true and |
| 65 // fills the given ChannelHandle with the information from the new channel. | 69 // fills the given ChannelHandle with the information from the new channel. |
| 66 bool SetupRendererChannel(base::ProcessHandle host_process_handle, | 70 bool SetupRendererChannel(int renderer_id, |
| 67 int renderer_id, | |
| 68 bool incognito, | 71 bool incognito, |
| 69 IPC::ChannelHandle* handle); | 72 IPC::ChannelHandle* handle); |
| 70 | 73 |
| 71 // Sets up the name of the plugin for logging using the given path. | 74 // Sets up the name of the plugin for logging using the given path. |
| 72 void SavePluginName(const FilePath& path); | 75 void SavePluginName(const FilePath& path); |
| 73 | 76 |
| 74 // True if running in a broker process rather than a normal plugin process. | 77 // True if running in a broker process rather than a normal plugin process. |
| 75 bool is_broker_; | 78 bool is_broker_; |
| 76 | 79 |
| 77 base::ScopedNativeLibrary library_; | 80 base::ScopedNativeLibrary library_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 96 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. | 99 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. |
| 97 std::set<PP_Instance> globally_seen_instance_ids_; | 100 std::set<PP_Instance> globally_seen_instance_ids_; |
| 98 | 101 |
| 99 // The PluginDispatcher instances contained in the map are not owned by it. | 102 // The PluginDispatcher instances contained in the map are not owned by it. |
| 100 std::map<uint32, ppapi::proxy::PluginDispatcher*> plugin_dispatchers_; | 103 std::map<uint32, ppapi::proxy::PluginDispatcher*> plugin_dispatchers_; |
| 101 uint32 next_plugin_dispatcher_id_; | 104 uint32 next_plugin_dispatcher_id_; |
| 102 | 105 |
| 103 // The WebKitPlatformSupport implementation. | 106 // The WebKitPlatformSupport implementation. |
| 104 scoped_ptr<PpapiWebKitPlatformSupportImpl> webkit_platform_support_; | 107 scoped_ptr<PpapiWebKitPlatformSupportImpl> webkit_platform_support_; |
| 105 | 108 |
| 109 // Caches the handle to the peer process if this is a broker. |
| 110 base::ProcessHandle peer_handle_; |
| 111 |
| 106 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); | 112 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); |
| 107 }; | 113 }; |
| 108 | 114 |
| 109 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 115 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| OLD | NEW |