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