| 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 "webkit/plugins/ppapi/plugin_module.h" | 5 #include "webkit/plugins/ppapi/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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // Create a new module, but don't set the lifetime delegate. This isn't a | 504 // Create a new module, but don't set the lifetime delegate. This isn't a |
| 505 // plugin in the usual sense, so it isn't tracked by the browser. | 505 // plugin in the usual sense, so it isn't tracked by the browser. |
| 506 scoped_refptr<PluginModule> nacl_module( | 506 scoped_refptr<PluginModule> nacl_module( |
| 507 new PluginModule(name_, | 507 new PluginModule(name_, |
| 508 path_, | 508 path_, |
| 509 NULL, // no lifetime_delegate | 509 NULL, // no lifetime_delegate |
| 510 permissions_)); | 510 permissions_)); |
| 511 return nacl_module; | 511 return nacl_module; |
| 512 } | 512 } |
| 513 | 513 |
| 514 void PluginModule::InitAsProxiedNaCl( | 514 void PluginModule::InitAsProxiedNaCl(PluginInstance* plugin_instance) { |
| 515 scoped_ptr<PluginDelegate::OutOfProcessProxy> out_of_process_proxy, | 515 DCHECK(out_of_process_proxy_.get()); |
| 516 PP_Instance instance) { | |
| 517 InitAsProxied(out_of_process_proxy.release()); | |
| 518 // InitAsProxied (for the trusted/out-of-process case) initializes only the | 516 // InitAsProxied (for the trusted/out-of-process case) initializes only the |
| 519 // module, and one or more instances are added later. In this case, the | 517 // module, and one or more instances are added later. In this case, the |
| 520 // PluginInstance was already created as in-process, so we missed the proxy | 518 // PluginInstance was already created as in-process, so we missed the proxy |
| 521 // AddInstance step and must do it now. | 519 // AddInstance step and must do it now. |
| 522 out_of_process_proxy_->AddInstance(instance); | 520 out_of_process_proxy_->AddInstance(plugin_instance->pp_instance()); |
| 523 // In NaCl, we need to tell the instance to reset itself as proxied. This will | 521 // In NaCl, we need to tell the instance to reset itself as proxied. This will |
| 524 // clear cached interface pointers and send DidCreate (etc) to the plugin | 522 // clear cached interface pointers and send DidCreate (etc) to the plugin |
| 525 // side of the proxy. | 523 // side of the proxy. |
| 526 PluginInstance* plugin_instance = host_globals->GetInstance(instance); | |
| 527 if (!plugin_instance) | |
| 528 return; | |
| 529 plugin_instance->ResetAsProxied(this); | 524 plugin_instance->ResetAsProxied(this); |
| 530 } | 525 } |
| 531 | 526 |
| 532 // static | 527 // static |
| 533 const PPB_Core* PluginModule::GetCore() { | 528 const PPB_Core* PluginModule::GetCore() { |
| 534 return &core_interface; | 529 return &core_interface; |
| 535 } | 530 } |
| 536 | 531 |
| 537 // static | 532 // static |
| 538 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { | 533 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 621 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
| 627 if (retval != 0) { | 622 if (retval != 0) { |
| 628 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 623 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
| 629 return false; | 624 return false; |
| 630 } | 625 } |
| 631 return true; | 626 return true; |
| 632 } | 627 } |
| 633 | 628 |
| 634 } // namespace ppapi | 629 } // namespace ppapi |
| 635 } // namespace webkit | 630 } // namespace webkit |
| OLD | NEW |