| 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/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 | 21 |
| 21 namespace IPC { | 22 namespace IPC { |
| 22 struct ChannelHandle; | 23 struct ChannelHandle; |
| 23 } | 24 } |
| 24 | 25 |
| 25 class PpapiThread : public ChildThread, | 26 class PpapiThread : public ChildThread, |
| 26 public pp::proxy::Dispatcher::Delegate { | 27 public pp::proxy::Dispatcher::Delegate { |
| 27 public: | 28 public: |
| 28 explicit PpapiThread(bool is_broker); | 29 explicit PpapiThread(bool is_broker); |
| 29 ~PpapiThread(); | 30 ~PpapiThread(); |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 // ChildThread overrides. | 33 // ChildThread overrides. |
| 33 virtual bool OnMessageReceived(const IPC::Message& msg); | 34 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 34 | 35 |
| 35 // Dispatcher::Delegate implementation. | 36 // Dispatcher::Delegate implementation. |
| 36 virtual base::MessageLoopProxy* GetIPCMessageLoop(); | 37 virtual base::MessageLoopProxy* GetIPCMessageLoop(); |
| 37 virtual base::WaitableEvent* GetShutdownEvent(); | 38 virtual base::WaitableEvent* GetShutdownEvent(); |
| 38 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet(); | 39 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet(); |
| 40 virtual void PostToWebKitThread(const tracked_objects::Location& from_here, |
| 41 const base::Closure& task); |
| 39 | 42 |
| 40 // Message handlers. | 43 // Message handlers. |
| 41 void OnMsgLoadPlugin(const FilePath& path); | 44 void OnMsgLoadPlugin(const FilePath& path); |
| 42 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, | 45 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, |
| 43 int renderer_id); | 46 int renderer_id); |
| 44 | 47 |
| 45 // Sets up the channel to the given renderer. On success, returns true and | 48 // Sets up the channel to the given renderer. On success, returns true and |
| 46 // fills the given ChannelHandle with the information from the new channel. | 49 // fills the given ChannelHandle with the information from the new channel. |
| 47 bool SetupRendererChannel(base::ProcessHandle host_process_handle, | 50 bool SetupRendererChannel(base::ProcessHandle host_process_handle, |
| 48 int renderer_id, | 51 int renderer_id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 63 // for the in-process PPAPI to handle this properly, but for proxied it's | 66 // for the in-process PPAPI to handle this properly, but for proxied it's |
| 64 // unnecessary. The proxy talking to multiple renderers means that each | 67 // unnecessary. The proxy talking to multiple renderers means that each |
| 65 // renderer has a different idea of what the module ID is for this plugin. | 68 // renderer has a different idea of what the module ID is for this plugin. |
| 66 // To force people to "do the right thing" we generate a random module ID | 69 // To force people to "do the right thing" we generate a random module ID |
| 67 // and pass it around as necessary. | 70 // and pass it around as necessary. |
| 68 PP_Module local_pp_module_; | 71 PP_Module local_pp_module_; |
| 69 | 72 |
| 70 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. | 73 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. |
| 71 std::set<PP_Instance> globally_seen_instance_ids_; | 74 std::set<PP_Instance> globally_seen_instance_ids_; |
| 72 | 75 |
| 76 scoped_ptr<PpapiWebKitThread> webkit_thread_; |
| 77 |
| 73 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); | 78 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); |
| 74 }; | 79 }; |
| 75 | 80 |
| 76 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 81 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| OLD | NEW |