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 pp::shared_impl::WebKitForwarding* GetWebKitForwarding(); |
| 41 virtual void PostToWebKitThread(const tracked_objects::Location& from_here, |
| 42 const base::Closure& task); |
39 | 43 |
40 // Message handlers. | 44 // Message handlers. |
41 void OnMsgLoadPlugin(const FilePath& path); | 45 void OnMsgLoadPlugin(const FilePath& path); |
42 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, | 46 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, |
43 int renderer_id); | 47 int renderer_id); |
44 | 48 |
45 // Sets up the channel to the given renderer. On success, returns true and | 49 // 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. | 50 // fills the given ChannelHandle with the information from the new channel. |
47 bool SetupRendererChannel(base::ProcessHandle host_process_handle, | 51 bool SetupRendererChannel(base::ProcessHandle host_process_handle, |
48 int renderer_id, | 52 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 | 67 // 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 | 68 // 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. | 69 // 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 | 70 // To force people to "do the right thing" we generate a random module ID |
67 // and pass it around as necessary. | 71 // and pass it around as necessary. |
68 PP_Module local_pp_module_; | 72 PP_Module local_pp_module_; |
69 | 73 |
70 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. | 74 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. |
71 std::set<PP_Instance> globally_seen_instance_ids_; | 75 std::set<PP_Instance> globally_seen_instance_ids_; |
72 | 76 |
| 77 // Lazily created by GetWebKitForwarding. |
| 78 scoped_ptr<pp::shared_impl::WebKitForwarding> webkit_forwarding_; |
| 79 |
| 80 scoped_ptr<PpapiWebKitThread> webkit_thread_; |
| 81 |
73 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); | 82 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); |
74 }; | 83 }; |
75 | 84 |
76 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 85 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
OLD | NEW |