Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/plugin_module.h" | 5 #include "content/renderer/pepper/plugin_module.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 // PPB_Core -------------------------------------------------------------------- | 180 // PPB_Core -------------------------------------------------------------------- |
| 181 | 181 |
| 182 void AddRefResource(PP_Resource resource) { | 182 void AddRefResource(PP_Resource resource) { |
| 183 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource); | 183 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void ReleaseResource(PP_Resource resource) { | 186 void ReleaseResource(PP_Resource resource) { |
| 187 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource); | 187 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource); |
| 188 } | 188 } |
| 189 | 189 |
| 190 PP_Time GetTime() { | 190 PP_Time GetTime() { return TimeToPPTime(base::Time::Now()); } |
| 191 return TimeToPPTime(base::Time::Now()); | |
| 192 } | |
| 193 | 191 |
| 194 PP_TimeTicks GetTickTime() { | 192 PP_TimeTicks GetTickTime() { |
| 195 return TimeTicksToPPTimeTicks(base::TimeTicks::Now()); | 193 return TimeTicksToPPTimeTicks(base::TimeTicks::Now()); |
| 196 } | 194 } |
| 197 | 195 |
| 198 void CallOnMainThread(int delay_in_msec, | 196 void CallOnMainThread(int delay_in_msec, |
| 199 PP_CompletionCallback callback, | 197 PP_CompletionCallback callback, |
| 200 int32_t result) { | 198 int32_t result) { |
| 201 if (callback.func) { | 199 if (callback.func) { |
| 202 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask( | 200 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask( |
| 203 FROM_HERE, | 201 FROM_HERE, |
| 204 base::Bind(callback.func, callback.user_data, result), | 202 base::Bind(callback.func, callback.user_data, result), |
| 205 base::TimeDelta::FromMilliseconds(delay_in_msec)); | 203 base::TimeDelta::FromMilliseconds(delay_in_msec)); |
| 206 } | 204 } |
| 207 } | 205 } |
| 208 | 206 |
| 209 PP_Bool IsMainThread() { | 207 PP_Bool IsMainThread() { |
| 210 return BoolToPPBool(PpapiGlobals::Get()-> | 208 return BoolToPPBool(PpapiGlobals::Get() |
| 211 GetMainThreadMessageLoop()->BelongsToCurrentThread()); | 209 ->GetMainThreadMessageLoop() |
| 210 ->BelongsToCurrentThread()); | |
| 212 } | 211 } |
| 213 | 212 |
| 214 const PPB_Core core_interface = { | 213 const PPB_Core core_interface = {&AddRefResource, &ReleaseResource, |
| 215 &AddRefResource, | 214 &GetTime, &GetTickTime, |
| 216 &ReleaseResource, | 215 &CallOnMainThread, &IsMainThread}; |
| 217 &GetTime, | |
| 218 &GetTickTime, | |
| 219 &CallOnMainThread, | |
| 220 &IsMainThread | |
| 221 }; | |
| 222 | 216 |
| 223 // PPB_Testing ----------------------------------------------------------------- | 217 // PPB_Testing ----------------------------------------------------------------- |
| 224 | 218 |
| 225 PP_Bool ReadImageData(PP_Resource device_context_2d, | 219 PP_Bool ReadImageData(PP_Resource device_context_2d, |
| 226 PP_Resource image, | 220 PP_Resource image, |
| 227 const PP_Point* top_left) { | 221 const PP_Point* top_left) { |
| 228 EnterResource<PPB_Graphics2D_API> enter(device_context_2d, true); | 222 EnterResource<PPB_Graphics2D_API> enter(device_context_2d, true); |
| 229 if (enter.failed()) | 223 if (enter.failed()) |
| 230 return PP_FALSE; | 224 return PP_FALSE; |
| 231 return BoolToPPBool(enter.object()->ReadImageData(image, top_left)); | 225 return BoolToPPBool(enter.object()->ReadImageData(image, top_left)); |
| 232 } | 226 } |
| 233 | 227 |
| 234 void RunMessageLoop(PP_Instance instance) { | 228 void RunMessageLoop(PP_Instance instance) { |
| 235 base::MessageLoop::ScopedNestableTaskAllower allow( | 229 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 236 base::MessageLoop::current()); | 230 base::MessageLoop::current()); |
| 237 base::MessageLoop::current()->Run(); | 231 base::MessageLoop::current()->Run(); |
| 238 } | 232 } |
| 239 | 233 |
| 240 void QuitMessageLoop(PP_Instance instance) { | 234 void QuitMessageLoop(PP_Instance instance) { |
| 241 base::MessageLoop::current()->QuitNow(); | 235 base::MessageLoop::current()->QuitNow(); |
| 242 } | 236 } |
| 243 | 237 |
| 244 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { | 238 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { |
| 245 return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance( | 239 return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance( |
| 246 instance_id); | 240 instance_id); |
| 247 } | 241 } |
| 248 | 242 |
| 249 PP_Bool IsOutOfProcess() { | 243 PP_Bool IsOutOfProcess() { return PP_FALSE; } |
| 250 return PP_FALSE; | |
| 251 } | |
| 252 | 244 |
| 253 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { | 245 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { |
| 254 PepperPluginInstanceImpl* plugin_instance = | 246 PepperPluginInstanceImpl* plugin_instance = |
| 255 host_globals->GetInstance(instance); | 247 host_globals->GetInstance(instance); |
| 256 if (!plugin_instance) | 248 if (!plugin_instance) |
| 257 return; | 249 return; |
| 258 | 250 |
| 259 EnterResource<PPB_InputEvent_API> enter(input_event, false); | 251 EnterResource<PPB_InputEvent_API> enter(input_event, false); |
| 260 if (enter.failed()) | 252 if (enter.failed()) |
| 261 return; | 253 return; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 281 live_vars[i] = vars[i]; | 273 live_vars[i] = vars[i]; |
| 282 return vars.size(); | 274 return vars.size(); |
| 283 } | 275 } |
| 284 | 276 |
| 285 void SetMinimumArrayBufferSizeForShmem(PP_Instance /*instance*/, | 277 void SetMinimumArrayBufferSizeForShmem(PP_Instance /*instance*/, |
| 286 uint32_t /*threshold*/) { | 278 uint32_t /*threshold*/) { |
| 287 // Does nothing. Not needed in-process. | 279 // Does nothing. Not needed in-process. |
| 288 } | 280 } |
| 289 | 281 |
| 290 const PPB_Testing_Private testing_interface = { | 282 const PPB_Testing_Private testing_interface = { |
| 291 &ReadImageData, | 283 &ReadImageData, &RunMessageLoop, |
| 292 &RunMessageLoop, | 284 &QuitMessageLoop, &GetLiveObjectsForInstance, |
| 293 &QuitMessageLoop, | 285 &IsOutOfProcess, &SimulateInputEvent, |
| 294 &GetLiveObjectsForInstance, | 286 &GetDocumentURL, &GetLiveVars, |
| 295 &IsOutOfProcess, | 287 &SetMinimumArrayBufferSizeForShmem}; |
|
bbudge
2014/04/07 17:02:17
Hmmm.
| |
| 296 &SimulateInputEvent, | |
| 297 &GetDocumentURL, | |
| 298 &GetLiveVars, | |
| 299 &SetMinimumArrayBufferSizeForShmem | |
| 300 }; | |
| 301 | 288 |
| 302 // GetInterface ---------------------------------------------------------------- | 289 // GetInterface ---------------------------------------------------------------- |
| 303 | 290 |
| 304 const void* InternalGetInterface(const char* name) { | 291 const void* InternalGetInterface(const char* name) { |
| 305 // Allow custom interface factories first stab at the GetInterface call. | 292 // Allow custom interface factories first stab at the GetInterface call. |
| 306 const void* custom_interface = | 293 const void* custom_interface = |
| 307 GetContentClient()->renderer()->CreatePPAPIInterface(name); | 294 GetContentClient()->renderer()->CreatePPAPIInterface(name); |
| 308 if (custom_interface) | 295 if (custom_interface) |
| 309 return custom_interface; | 296 return custom_interface; |
| 310 | 297 |
| 311 // TODO(brettw) put these in a hash map for better performance. | 298 // TODO(brettw) put these in a hash map for better performance. |
| 312 #define PROXIED_IFACE(iface_str, iface_struct) \ | 299 #define PROXIED_IFACE(iface_str, iface_struct) \ |
| 313 if (strcmp(name, iface_str) == 0) \ | 300 if (strcmp(name, iface_str) == 0) \ |
| 314 return ppapi::thunk::Get##iface_struct##_Thunk(); | 301 return ppapi::thunk::Get##iface_struct##_Thunk(); |
| 315 | 302 |
| 316 #include "ppapi/thunk/interfaces_ppb_private.h" | 303 #include "ppapi/thunk/interfaces_ppb_private.h" |
| 317 #include "ppapi/thunk/interfaces_ppb_private_flash.h" | 304 #include "ppapi/thunk/interfaces_ppb_private_flash.h" |
| 318 #include "ppapi/thunk/interfaces_ppb_private_no_permissions.h" | 305 #include "ppapi/thunk/interfaces_ppb_private_no_permissions.h" |
| 319 #include "ppapi/thunk/interfaces_ppb_public_dev.h" | 306 #include "ppapi/thunk/interfaces_ppb_public_dev.h" |
| 320 #include "ppapi/thunk/interfaces_ppb_public_dev_channel.h" | 307 #include "ppapi/thunk/interfaces_ppb_public_dev_channel.h" |
| 321 #include "ppapi/thunk/interfaces_ppb_public_stable.h" | 308 #include "ppapi/thunk/interfaces_ppb_public_stable.h" |
| 322 | 309 |
| 323 #undef PROXIED_IFACE | 310 #undef PROXIED_IFACE |
| 324 | 311 |
| 325 #define LEGACY_IFACE(iface_str, function_name) \ | 312 #define LEGACY_IFACE(iface_str, function_name) \ |
| 326 if (strcmp(name, iface_str) == 0) \ | 313 if (strcmp(name, iface_str) == 0) \ |
| 327 return function_name; | 314 return function_name; |
| 328 | 315 |
| 329 #include "ppapi/thunk/interfaces_legacy.h" | 316 #include "ppapi/thunk/interfaces_legacy.h" |
| 330 | 317 |
| 331 #undef LEGACY_IFACE | 318 #undef LEGACY_IFACE |
| 332 | 319 |
| 333 // Only support the testing interface when the command line switch is | 320 // Only support the testing interface when the command line switch is |
| 334 // specified. This allows us to prevent people from (ab)using this interface | 321 // specified. This allows us to prevent people from (ab)using this interface |
| 335 // in production code. | 322 // in production code. |
| 336 if (CommandLine::ForCurrentProcess()->HasSwitch( | 323 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 337 switches::kEnablePepperTesting)) { | 324 switches::kEnablePepperTesting)) { |
| 338 if (strcmp(name, PPB_TESTING_PRIVATE_INTERFACE) == 0) | 325 if (strcmp(name, PPB_TESTING_PRIVATE_INTERFACE) == 0) |
| 339 return &testing_interface; | 326 return &testing_interface; |
| 340 } | 327 } |
| 341 return NULL; | 328 return NULL; |
| 342 } | 329 } |
| 343 | 330 |
| 344 const void* GetInterface(const char* name) { | 331 const void* GetInterface(const char* name) { |
| 345 // All interfaces should be used on the main thread. | 332 // All interfaces should be used on the main thread. |
| 346 CHECK(IsMainThread()); | 333 CHECK(IsMainThread()); |
| 347 | 334 |
| 348 return InternalGetInterface(name); | 335 return InternalGetInterface(name); |
| 349 } | 336 } |
| 350 | 337 |
| 351 // Gets the PPAPI entry points from the given library and places them into the | 338 // Gets the PPAPI entry points from the given library and places them into the |
| 352 // given structure. Returns true on success. | 339 // given structure. Returns true on success. |
| 353 bool LoadEntryPointsFromLibrary( | 340 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, |
| 354 const base::NativeLibrary& library, | 341 PepperPluginInfo::EntryPoints* entry_points) { |
| 355 PepperPluginInfo::EntryPoints* entry_points) { | |
| 356 entry_points->get_interface = | 342 entry_points->get_interface = |
| 357 reinterpret_cast<PepperPluginInfo::GetInterfaceFunc>( | 343 reinterpret_cast<PepperPluginInfo::GetInterfaceFunc>( |
| 358 base::GetFunctionPointerFromNativeLibrary(library, | 344 base::GetFunctionPointerFromNativeLibrary(library, |
| 359 "PPP_GetInterface")); | 345 "PPP_GetInterface")); |
| 360 if (!entry_points->get_interface) { | 346 if (!entry_points->get_interface) { |
| 361 LOG(WARNING) << "No PPP_GetInterface in plugin library"; | 347 LOG(WARNING) << "No PPP_GetInterface in plugin library"; |
| 362 return false; | 348 return false; |
| 363 } | 349 } |
| 364 | 350 |
| 365 entry_points->initialize_module = | 351 entry_points->initialize_module = |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 382 } | 368 } |
| 383 | 369 |
| 384 void CreateHostForInProcessModule(RenderFrameImpl* render_frame, | 370 void CreateHostForInProcessModule(RenderFrameImpl* render_frame, |
| 385 PluginModule* module, | 371 PluginModule* module, |
| 386 const WebPluginInfo& webplugin_info) { | 372 const WebPluginInfo& webplugin_info) { |
| 387 // First time an in-process plugin was used, make a host for it. | 373 // First time an in-process plugin was used, make a host for it. |
| 388 const PepperPluginInfo* info = | 374 const PepperPluginInfo* info = |
| 389 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); | 375 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); |
| 390 DCHECK(!info->is_out_of_process); | 376 DCHECK(!info->is_out_of_process); |
| 391 | 377 |
| 392 ppapi::PpapiPermissions perms( | 378 ppapi::PpapiPermissions perms(PepperPluginRegistry::GetInstance() |
| 393 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( | 379 ->GetInfoForPlugin(webplugin_info) |
| 394 webplugin_info)->permissions); | 380 ->permissions); |
| 395 RendererPpapiHostImpl* host_impl = | 381 RendererPpapiHostImpl* host_impl = |
| 396 RendererPpapiHostImpl::CreateOnModuleForInProcess(module, perms); | 382 RendererPpapiHostImpl::CreateOnModuleForInProcess(module, perms); |
| 397 render_frame->PepperPluginCreated(host_impl); | 383 render_frame->PepperPluginCreated(host_impl); |
| 398 } | 384 } |
| 399 | 385 |
| 400 } // namespace | 386 } // namespace |
| 401 | 387 |
| 402 // PluginModule ---------------------------------------------------------------- | 388 // PluginModule ---------------------------------------------------------------- |
| 403 | 389 |
| 404 PluginModule::PluginModule(const std::string& name, | 390 PluginModule::PluginModule(const std::string& name, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 return true; | 477 return true; |
| 492 } | 478 } |
| 493 | 479 |
| 494 void PluginModule::InitAsProxied( | 480 void PluginModule::InitAsProxied( |
| 495 HostDispatcherWrapper* host_dispatcher_wrapper) { | 481 HostDispatcherWrapper* host_dispatcher_wrapper) { |
| 496 DCHECK(!host_dispatcher_wrapper_.get()); | 482 DCHECK(!host_dispatcher_wrapper_.get()); |
| 497 host_dispatcher_wrapper_.reset(host_dispatcher_wrapper); | 483 host_dispatcher_wrapper_.reset(host_dispatcher_wrapper); |
| 498 } | 484 } |
| 499 | 485 |
| 500 scoped_refptr<PluginModule> | 486 scoped_refptr<PluginModule> |
| 501 PluginModule::CreateModuleForExternalPluginInstance() { | 487 PluginModule::CreateModuleForExternalPluginInstance() { |
| 502 // Create a new module, but don't set the lifetime delegate. This isn't a | 488 // Create a new module, but don't set the lifetime delegate. This isn't a |
| 503 // plugin in the usual sense, so it isn't tracked by the browser. | 489 // plugin in the usual sense, so it isn't tracked by the browser. |
| 504 scoped_refptr<PluginModule> external_plugin_module( | 490 scoped_refptr<PluginModule> external_plugin_module( |
| 505 new PluginModule(name_, | 491 new PluginModule(name_, path_, permissions_)); |
| 506 path_, | |
| 507 permissions_)); | |
| 508 return external_plugin_module; | 492 return external_plugin_module; |
| 509 } | 493 } |
| 510 | 494 |
| 511 PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin( | 495 PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin( |
| 512 PepperPluginInstanceImpl* instance) { | 496 PepperPluginInstanceImpl* instance) { |
| 513 DCHECK(host_dispatcher_wrapper_.get()); | 497 DCHECK(host_dispatcher_wrapper_.get()); |
| 514 // InitAsProxied (for the trusted/out-of-process case) initializes only the | 498 // InitAsProxied (for the trusted/out-of-process case) initializes only the |
| 515 // module, and one or more instances are added later. In this case, the | 499 // module, and one or more instances are added later. In this case, the |
| 516 // PluginInstance was already created as in-process, so we missed the proxy | 500 // PluginInstance was already created as in-process, so we missed the proxy |
| 517 // AddInstance step and must do it now. | 501 // AddInstance step and must do it now. |
| 518 host_dispatcher_wrapper_->AddInstance(instance->pp_instance()); | 502 host_dispatcher_wrapper_->AddInstance(instance->pp_instance()); |
| 519 // For external plugins, we need to tell the instance to reset itself as | 503 // For external plugins, we need to tell the instance to reset itself as |
| 520 // proxied. This will clear cached interface pointers and send DidCreate (etc) | 504 // proxied. This will clear cached interface pointers and send DidCreate (etc) |
| 521 // to the plugin side of the proxy. | 505 // to the plugin side of the proxy. |
| 522 return instance->ResetAsProxied(this); | 506 return instance->ResetAsProxied(this); |
| 523 } | 507 } |
| 524 | 508 |
| 525 bool PluginModule::IsProxied() const { | 509 bool PluginModule::IsProxied() const { return !!host_dispatcher_wrapper_; } |
| 526 return !!host_dispatcher_wrapper_; | |
| 527 } | |
| 528 | 510 |
| 529 base::ProcessId PluginModule::GetPeerProcessId() { | 511 base::ProcessId PluginModule::GetPeerProcessId() { |
| 530 if (host_dispatcher_wrapper_) | 512 if (host_dispatcher_wrapper_) |
| 531 return host_dispatcher_wrapper_->peer_pid(); | 513 return host_dispatcher_wrapper_->peer_pid(); |
| 532 return base::kNullProcessId; | 514 return base::kNullProcessId; |
| 533 } | 515 } |
| 534 | 516 |
| 535 int PluginModule::GetPluginChildId() { | 517 int PluginModule::GetPluginChildId() { |
| 536 if (host_dispatcher_wrapper_) | 518 if (host_dispatcher_wrapper_) |
| 537 return host_dispatcher_wrapper_->plugin_child_id(); | 519 return host_dispatcher_wrapper_->plugin_child_id(); |
| 538 return 0; | 520 return 0; |
| 539 } | 521 } |
| 540 | 522 |
| 541 // static | 523 // static |
| 542 const PPB_Core* PluginModule::GetCore() { | 524 const PPB_Core* PluginModule::GetCore() { return &core_interface; } |
| 543 return &core_interface; | |
| 544 } | |
| 545 | 525 |
| 546 // static | 526 // static |
| 547 bool PluginModule::SupportsInterface(const char* name) { | 527 bool PluginModule::SupportsInterface(const char* name) { |
| 548 return !!InternalGetInterface(name); | 528 return !!InternalGetInterface(name); |
| 549 } | 529 } |
| 550 | 530 |
| 551 PepperPluginInstanceImpl* PluginModule::CreateInstance( | 531 PepperPluginInstanceImpl* PluginModule::CreateInstance( |
| 552 RenderFrameImpl* render_frame, | 532 RenderFrameImpl* render_frame, |
| 553 blink::WebPluginContainer* container, | 533 blink::WebPluginContainer* container, |
| 554 const GURL& plugin_url) { | 534 const GURL& plugin_url) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 scoped_refptr<ppapi::CallbackTracker> PluginModule::GetCallbackTracker() { | 573 scoped_refptr<ppapi::CallbackTracker> PluginModule::GetCallbackTracker() { |
| 594 return callback_tracker_; | 574 return callback_tracker_; |
| 595 } | 575 } |
| 596 | 576 |
| 597 void PluginModule::PluginCrashed() { | 577 void PluginModule::PluginCrashed() { |
| 598 DCHECK(!is_crashed_); // Should only get one notification. | 578 DCHECK(!is_crashed_); // Should only get one notification. |
| 599 is_crashed_ = true; | 579 is_crashed_ = true; |
| 600 | 580 |
| 601 // Notify all instances that they crashed. | 581 // Notify all instances that they crashed. |
| 602 for (PluginInstanceSet::iterator i = instances_.begin(); | 582 for (PluginInstanceSet::iterator i = instances_.begin(); |
| 603 i != instances_.end(); ++i) | 583 i != instances_.end(); |
| 584 ++i) | |
| 604 (*i)->InstanceCrashed(); | 585 (*i)->InstanceCrashed(); |
| 605 | 586 |
| 606 PepperPluginRegistry::GetInstance()->PluginModuleDead(this); | 587 PepperPluginRegistry::GetInstance()->PluginModuleDead(this); |
| 607 } | 588 } |
| 608 | 589 |
| 609 void PluginModule::SetReserveInstanceIDCallback( | 590 void PluginModule::SetReserveInstanceIDCallback( |
| 610 PP_Bool (*reserve)(PP_Module, PP_Instance)) { | 591 PP_Bool (*reserve)(PP_Module, PP_Instance)) { |
| 611 DCHECK(!reserve_instance_id_) << "Only expect one set."; | 592 DCHECK(!reserve_instance_id_) << "Only expect one set."; |
| 612 reserve_instance_id_ = reserve; | 593 reserve_instance_id_ = reserve; |
| 613 } | 594 } |
| 614 | 595 |
| 615 bool PluginModule::ReserveInstanceID(PP_Instance instance) { | 596 bool PluginModule::ReserveInstanceID(PP_Instance instance) { |
| 616 if (reserve_instance_id_) | 597 if (reserve_instance_id_) |
| 617 return PPBoolToBool(reserve_instance_id_(pp_module_, instance)); | 598 return PPBoolToBool(reserve_instance_id_(pp_module_, instance)); |
| 618 return true; // Instance ID is usable. | 599 return true; // Instance ID is usable. |
| 619 } | 600 } |
| 620 | 601 |
| 621 void PluginModule::SetBroker(PepperBroker* broker) { | 602 void PluginModule::SetBroker(PepperBroker* broker) { |
| 622 DCHECK(!broker_ || !broker); | 603 DCHECK(!broker_ || !broker); |
| 623 broker_ = broker; | 604 broker_ = broker; |
| 624 } | 605 } |
| 625 | 606 |
| 626 PepperBroker* PluginModule::GetBroker() { | 607 PepperBroker* PluginModule::GetBroker() { return broker_; } |
| 627 return broker_; | |
| 628 } | |
| 629 | 608 |
| 630 RendererPpapiHostImpl* PluginModule::CreateOutOfProcessModule( | 609 RendererPpapiHostImpl* PluginModule::CreateOutOfProcessModule( |
| 631 RenderFrameImpl* render_frame, | 610 RenderFrameImpl* render_frame, |
| 632 const base::FilePath& path, | 611 const base::FilePath& path, |
| 633 ppapi::PpapiPermissions permissions, | 612 ppapi::PpapiPermissions permissions, |
| 634 const IPC::ChannelHandle& channel_handle, | 613 const IPC::ChannelHandle& channel_handle, |
| 635 base::ProcessId peer_pid, | 614 base::ProcessId peer_pid, |
| 636 int plugin_child_id, | 615 int plugin_child_id, |
| 637 bool is_external) { | 616 bool is_external) { |
| 638 scoped_refptr<PepperHungPluginFilter> hung_filter(new PepperHungPluginFilter( | 617 scoped_refptr<PepperHungPluginFilter> hung_filter(new PepperHungPluginFilter( |
| 639 path, render_frame->GetRoutingID(), plugin_child_id)); | 618 path, render_frame->GetRoutingID(), plugin_child_id)); |
| 640 scoped_ptr<HostDispatcherWrapper> dispatcher( | 619 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper( |
| 641 new HostDispatcherWrapper(this, | 620 this, peer_pid, plugin_child_id, permissions, is_external)); |
| 642 peer_pid, | |
| 643 plugin_child_id, | |
| 644 permissions, | |
| 645 is_external)); | |
| 646 if (!dispatcher->Init( | 621 if (!dispatcher->Init( |
| 647 channel_handle, | 622 channel_handle, |
| 648 &GetInterface, | 623 &GetInterface, |
| 649 ppapi::Preferences(render_frame->render_view()->webkit_preferences()), | 624 ppapi::Preferences(render_frame->render_view()->webkit_preferences()), |
| 650 hung_filter.get())) | 625 hung_filter.get())) |
| 651 return NULL; | 626 return NULL; |
| 652 | 627 |
| 653 RendererPpapiHostImpl* host_impl = | 628 RendererPpapiHostImpl* host_impl = |
| 654 RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( | 629 RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( |
| 655 this, dispatcher->dispatcher(), permissions); | 630 this, dispatcher->dispatcher(), permissions); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 channel_handle, | 710 channel_handle, |
| 736 peer_pid, | 711 peer_pid, |
| 737 plugin_child_id, | 712 plugin_child_id, |
| 738 false)) // is_external = false | 713 false)) // is_external = false |
| 739 return scoped_refptr<PluginModule>(); | 714 return scoped_refptr<PluginModule>(); |
| 740 | 715 |
| 741 return module; | 716 return module; |
| 742 } | 717 } |
| 743 | 718 |
| 744 } // namespace content | 719 } // namespace content |
| OLD | NEW |