Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 290553004: PPAPI: Refactor MessageChannel to prep for sync postMessae (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move NaClHelper in to nacl namespace Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 23 matching lines...) Expand all
34 CONTENT_EXPORT RendererPpapiHost* RendererPpapiHost::GetForPPInstance( 34 CONTENT_EXPORT RendererPpapiHost* RendererPpapiHost::GetForPPInstance(
35 PP_Instance instance) { 35 PP_Instance instance) {
36 return RendererPpapiHostImpl::GetForPPInstance(instance); 36 return RendererPpapiHostImpl::GetForPPInstance(instance);
37 } 37 }
38 38
39 // Out-of-process constructor. 39 // Out-of-process constructor.
40 RendererPpapiHostImpl::RendererPpapiHostImpl( 40 RendererPpapiHostImpl::RendererPpapiHostImpl(
41 PluginModule* module, 41 PluginModule* module,
42 ppapi::proxy::HostDispatcher* dispatcher, 42 ppapi::proxy::HostDispatcher* dispatcher,
43 const ppapi::PpapiPermissions& permissions) 43 const ppapi::PpapiPermissions& permissions)
44 : module_(module), dispatcher_(dispatcher) { 44 : module_(module),
45 dispatcher_(dispatcher),
46 is_external_plugin_host_(false) {
45 // Hook the PpapiHost up to the dispatcher for out-of-process communication. 47 // Hook the PpapiHost up to the dispatcher for out-of-process communication.
46 ppapi_host_.reset(new ppapi::host::PpapiHost(dispatcher, permissions)); 48 ppapi_host_.reset(new ppapi::host::PpapiHost(dispatcher, permissions));
47 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( 49 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
48 new ContentRendererPepperHostFactory(this))); 50 new ContentRendererPepperHostFactory(this)));
49 dispatcher->AddFilter(ppapi_host_.get()); 51 dispatcher->AddFilter(ppapi_host_.get());
50 is_running_in_process_ = false; 52 is_running_in_process_ = false;
51 } 53 }
52 54
53 // In-process constructor. 55 // In-process constructor.
54 RendererPpapiHostImpl::RendererPpapiHostImpl( 56 RendererPpapiHostImpl::RendererPpapiHostImpl(
55 PluginModule* module, 57 PluginModule* module,
56 const ppapi::PpapiPermissions& permissions) 58 const ppapi::PpapiPermissions& permissions)
57 : module_(module), dispatcher_(NULL) { 59 : module_(module), dispatcher_(NULL), is_external_plugin_host_(false) {
58 // Hook the host up to the in-process router. 60 // Hook the host up to the in-process router.
59 in_process_router_.reset(new PepperInProcessRouter(this)); 61 in_process_router_.reset(new PepperInProcessRouter(this));
60 ppapi_host_.reset(new ppapi::host::PpapiHost( 62 ppapi_host_.reset(new ppapi::host::PpapiHost(
61 in_process_router_->GetRendererToPluginSender(), permissions)); 63 in_process_router_->GetRendererToPluginSender(), permissions));
62 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( 64 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
63 new ContentRendererPepperHostFactory(this))); 65 new ContentRendererPepperHostFactory(this)));
64 is_running_in_process_ = true; 66 is_running_in_process_ = true;
65 } 67 }
66 68
67 RendererPpapiHostImpl::~RendererPpapiHostImpl() { 69 RendererPpapiHostImpl::~RendererPpapiHostImpl() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 PepperPluginInstanceImpl* instance) { 120 PepperPluginInstanceImpl* instance) {
119 return scoped_ptr<ppapi::thunk::ResourceCreationAPI>( 121 return scoped_ptr<ppapi::thunk::ResourceCreationAPI>(
120 new PepperInProcessResourceCreation(this, instance)); 122 new PepperInProcessResourceCreation(this, instance));
121 } 123 }
122 124
123 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetPluginInstanceImpl( 125 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetPluginInstanceImpl(
124 PP_Instance instance) const { 126 PP_Instance instance) const {
125 return GetAndValidateInstance(instance); 127 return GetAndValidateInstance(instance);
126 } 128 }
127 129
130 bool RendererPpapiHostImpl::IsExternalPluginHost() const {
131 return is_external_plugin_host_;
132 }
133
128 ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() { 134 ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() {
129 return ppapi_host_.get(); 135 return ppapi_host_.get();
130 } 136 }
131 137
132 RenderFrame* RendererPpapiHostImpl::GetRenderFrameForInstance( 138 RenderFrame* RendererPpapiHostImpl::GetRenderFrameForInstance(
133 PP_Instance instance) const { 139 PP_Instance instance) const {
134 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); 140 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
135 if (!instance_object) 141 if (!instance_object)
136 return NULL; 142 return NULL;
137 143
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return BrokerGetFileHandleForProcess( 226 return BrokerGetFileHandleForProcess(
221 handle, base::GetCurrentProcId(), should_close_source); 227 handle, base::GetCurrentProcId(), should_close_source);
222 } 228 }
223 return dispatcher_->ShareHandleWithRemote(handle, should_close_source); 229 return dispatcher_->ShareHandleWithRemote(handle, should_close_source);
224 } 230 }
225 231
226 bool RendererPpapiHostImpl::IsRunningInProcess() const { 232 bool RendererPpapiHostImpl::IsRunningInProcess() const {
227 return is_running_in_process_; 233 return is_running_in_process_;
228 } 234 }
229 235
236 std::string RendererPpapiHostImpl::GetPluginName() const {
237 return module_->name();
238 }
239
240 void RendererPpapiHostImpl::SetToExternalPluginHost() {
241 is_external_plugin_host_ = true;
242 }
243
230 void RendererPpapiHostImpl::CreateBrowserResourceHosts( 244 void RendererPpapiHostImpl::CreateBrowserResourceHosts(
231 PP_Instance instance, 245 PP_Instance instance,
232 const std::vector<IPC::Message>& nested_msgs, 246 const std::vector<IPC::Message>& nested_msgs,
233 const base::Callback<void(const std::vector<int>&)>& callback) const { 247 const base::Callback<void(const std::vector<int>&)>& callback) const {
234 RenderFrame* render_frame = GetRenderFrameForInstance(instance); 248 RenderFrame* render_frame = GetRenderFrameForInstance(instance);
235 PepperBrowserConnection* browser_connection = 249 PepperBrowserConnection* browser_connection =
236 PepperBrowserConnection::Get(render_frame); 250 PepperBrowserConnection::Get(render_frame);
237 if (!browser_connection) { 251 if (!browser_connection) {
238 base::MessageLoop::current()->PostTask( 252 base::MessageLoop::current()->PostTask(
239 FROM_HERE, 253 FROM_HERE,
(...skipping 17 matching lines...) Expand all
257 PepperPluginInstanceImpl* instance = 271 PepperPluginInstanceImpl* instance =
258 HostGlobals::Get()->GetInstance(pp_instance); 272 HostGlobals::Get()->GetInstance(pp_instance);
259 if (!instance) 273 if (!instance)
260 return NULL; 274 return NULL;
261 if (!instance->IsValidInstanceOf(module_)) 275 if (!instance->IsValidInstanceOf(module_))
262 return NULL; 276 return NULL;
263 return instance; 277 return instance;
264 } 278 }
265 279
266 } // namespace content 280 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/renderer_ppapi_host_impl.h ('k') | content/renderer/pepper/resource_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698