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

Side by Side Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 10543029: PPAPI/NaCl: Reinitialize some stuff when the ipc proxy starts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: should fix mac Created 8 years, 6 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
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 library_ = library; 488 library_ = library;
489 return true; 489 return true;
490 } 490 }
491 491
492 void PluginModule::InitAsProxied( 492 void PluginModule::InitAsProxied(
493 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) { 493 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) {
494 DCHECK(!out_of_process_proxy_.get()); 494 DCHECK(!out_of_process_proxy_.get());
495 out_of_process_proxy_.reset(out_of_process_proxy); 495 out_of_process_proxy_.reset(out_of_process_proxy);
496 } 496 }
497 497
498 void PluginModule::InitAsProxiedNaCl(
499 PluginDelegate::OutOfProcessProxy* out_of_process_proxy,
500 PP_Instance instance) {
501 InitAsProxied(out_of_process_proxy);
502 // InitAsProxied (for the trusted/out-of-process case) initializes only the
503 // module, and one or more instances are added later. In this case, the
504 // PluginInstance was already created as in-process, so we missed the proxy
505 // AddInstance step and must do it now.
506 out_of_process_proxy_->AddInstance(instance);
507
508 // In NaCl, we need to tell the instance to reset itself as proxied. This will
509 // clear cached interface pointers and send DidCreate (etc) to the plugin
510 // side of the proxy.
511 PluginInstance* plugin_instance = host_globals->GetInstance(instance);
512 if (!plugin_instance)
513 return;
514 plugin_instance->ResetAsProxied();
515 }
516
498 // static 517 // static
499 const PPB_Core* PluginModule::GetCore() { 518 const PPB_Core* PluginModule::GetCore() {
500 return &core_interface; 519 return &core_interface;
501 } 520 }
502 521
503 // static 522 // static
504 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { 523 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() {
505 return &GetInterface; 524 return &GetInterface;
506 } 525 }
507 526
508 PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { 527 PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) {
509 PluginInstance* instance(NULL); 528 PluginInstance* instance = PluginInstance::Create(delegate, this);
510 const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_1);
511 if (ppp_instance) {
512 instance = PluginInstance::Create1_1(delegate, this, ppp_instance);
513 } else if ((ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0))) {
514 instance = PluginInstance::Create1_0(delegate, this, ppp_instance);
515 }
516
517 if (!instance) { 529 if (!instance) {
518 LOG(WARNING) << "Plugin doesn't support instance interface, failing."; 530 LOG(WARNING) << "Plugin doesn't support instance interface, failing.";
519 return NULL; 531 return NULL;
520 } 532 }
521 if (out_of_process_proxy_.get()) 533 if (out_of_process_proxy_.get())
522 out_of_process_proxy_->AddInstance(instance->pp_instance()); 534 out_of_process_proxy_->AddInstance(instance->pp_instance());
523 return instance; 535 return instance;
524 } 536 }
525 537
526 PluginInstance* PluginModule::GetSomeInstance() const { 538 PluginInstance* PluginModule::GetSomeInstance() const {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 int retval = entry_points.initialize_module(pp_module(), &GetInterface); 606 int retval = entry_points.initialize_module(pp_module(), &GetInterface);
595 if (retval != 0) { 607 if (retval != 0) {
596 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 608 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
597 return false; 609 return false;
598 } 610 }
599 return true; 611 return true;
600 } 612 }
601 613
602 } // namespace ppapi 614 } // namespace ppapi
603 } // namespace webkit 615 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698