| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/process.h" | 12 #include "base/process.h" |
| 12 #include "base/scoped_native_library.h" | 13 #include "base/scoped_native_library.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "content/common/child_thread.h" | 15 #include "content/common/child_thread.h" |
| 15 #include "ppapi/c/pp_module.h" | 16 #include "ppapi/c/pp_module.h" |
| 16 #include "ppapi/c/trusted/ppp_broker.h" | 17 #include "ppapi/c/trusted/ppp_broker.h" |
| 17 #include "ppapi/proxy/plugin_dispatcher.h" | 18 #include "ppapi/proxy/plugin_dispatcher.h" |
| 18 | 19 |
| 19 class FilePath; | 20 class FilePath; |
| 20 class PpapiWebKitThread; | 21 class PpapiWebKitThread; |
| 21 | 22 |
| 22 namespace IPC { | 23 namespace IPC { |
| 23 struct ChannelHandle; | 24 struct ChannelHandle; |
| 24 } | 25 } |
| 25 | 26 |
| 26 class PpapiThread : public ChildThread, | 27 class PpapiThread : public ChildThread, |
| 27 public pp::proxy::PluginDispatcher::PluginDelegate { | 28 public pp::proxy::PluginDispatcher::PluginDelegate { |
| 28 public: | 29 public: |
| 29 explicit PpapiThread(bool is_broker); | 30 explicit PpapiThread(bool is_broker); |
| 30 virtual ~PpapiThread(); | 31 virtual ~PpapiThread(); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 // ChildThread overrides. | 34 // ChildThread overrides. |
| 34 virtual bool OnMessageReceived(const IPC::Message& msg); | 35 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 35 | 36 |
| 36 // Dispatcher::Delegate implementation. | 37 // Dispatcher::Delegate implementation. |
| 37 virtual base::MessageLoopProxy* GetIPCMessageLoop(); | 38 virtual base::MessageLoopProxy* GetIPCMessageLoop() OVERRIDE; |
| 38 virtual base::WaitableEvent* GetShutdownEvent(); | 39 virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE; |
| 39 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet(); | 40 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() OVERRIDE; |
| 40 virtual ppapi::WebKitForwarding* GetWebKitForwarding(); | 41 virtual ppapi::WebKitForwarding* GetWebKitForwarding() OVERRIDE; |
| 41 virtual void PostToWebKitThread(const tracked_objects::Location& from_here, | 42 virtual void PostToWebKitThread(const tracked_objects::Location& from_here, |
| 42 const base::Closure& task); | 43 const base::Closure& task) OVERRIDE; |
| 43 virtual bool SendToBrowser(IPC::Message* msg); | 44 virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE; |
| 44 | 45 |
| 45 // Message handlers. | 46 // Message handlers. |
| 46 void OnMsgLoadPlugin(const FilePath& path); | 47 void OnMsgLoadPlugin(const FilePath& path); |
| 47 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, | 48 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, |
| 48 int renderer_id); | 49 int renderer_id); |
| 49 | 50 |
| 50 // Sets up the channel to the given renderer. On success, returns true and | 51 // Sets up the channel to the given renderer. On success, returns true and |
| 51 // fills the given ChannelHandle with the information from the new channel. | 52 // fills the given ChannelHandle with the information from the new channel. |
| 52 bool SetupRendererChannel(base::ProcessHandle host_process_handle, | 53 bool SetupRendererChannel(base::ProcessHandle host_process_handle, |
| 53 int renderer_id, | 54 int renderer_id, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 77 | 78 |
| 78 // Lazily created by GetWebKitForwarding. | 79 // Lazily created by GetWebKitForwarding. |
| 79 scoped_ptr<ppapi::WebKitForwarding> webkit_forwarding_; | 80 scoped_ptr<ppapi::WebKitForwarding> webkit_forwarding_; |
| 80 | 81 |
| 81 scoped_ptr<PpapiWebKitThread> webkit_thread_; | 82 scoped_ptr<PpapiWebKitThread> webkit_thread_; |
| 82 | 83 |
| 83 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); | 84 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 87 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| OLD | NEW |