| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 library_ = library; | 486 library_ = library; |
| 487 return true; | 487 return true; |
| 488 } | 488 } |
| 489 | 489 |
| 490 void PluginModule::InitAsProxied( | 490 void PluginModule::InitAsProxied( |
| 491 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) { | 491 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) { |
| 492 DCHECK(!out_of_process_proxy_.get()); | 492 DCHECK(!out_of_process_proxy_.get()); |
| 493 out_of_process_proxy_.reset(out_of_process_proxy); | 493 out_of_process_proxy_.reset(out_of_process_proxy); |
| 494 } | 494 } |
| 495 | 495 |
| 496 void PluginModule::InitAsProxiedNaCl( |
| 497 PluginDelegate::OutOfProcessProxy* out_of_process_proxy, |
| 498 PP_Instance instance) { |
| 499 InitAsProxied(out_of_process_proxy); |
| 500 out_of_process_proxy_->AddInstance(instance); |
| 501 |
| 502 // In NaCl, we need to tell the instance to reset itself as proxied. This will |
| 503 // clear cached interface pointers and send DidCreate (etc) to the plugin |
| 504 // side of the proxy. |
| 505 PluginInstance* plugin_instance = host_globals->GetInstance(instance); |
| 506 if (!plugin_instance) |
| 507 return; |
| 508 plugin_instance->ResetAsProxied(); |
| 509 } |
| 510 |
| 496 // static | 511 // static |
| 497 const PPB_Core* PluginModule::GetCore() { | 512 const PPB_Core* PluginModule::GetCore() { |
| 498 return &core_interface; | 513 return &core_interface; |
| 499 } | 514 } |
| 500 | 515 |
| 501 // static | 516 // static |
| 502 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { | 517 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { |
| 503 return &GetInterface; | 518 return &GetInterface; |
| 504 } | 519 } |
| 505 | 520 |
| 506 PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { | 521 PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { |
| 507 PluginInstance* instance(NULL); | 522 PluginInstance* instance = PluginInstance::Create(delegate, this); |
| 508 const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_1); | |
| 509 if (ppp_instance) { | |
| 510 instance = PluginInstance::Create1_1(delegate, this, ppp_instance); | |
| 511 } else if ((ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0))) { | |
| 512 instance = PluginInstance::Create1_0(delegate, this, ppp_instance); | |
| 513 } | |
| 514 | 523 |
| 515 if (!instance) { | 524 if (!instance) { |
| 516 LOG(WARNING) << "Plugin doesn't support instance interface, failing."; | 525 LOG(WARNING) << "Plugin doesn't support instance interface, failing."; |
| 517 return NULL; | 526 return NULL; |
| 518 } | 527 } |
| 519 if (out_of_process_proxy_.get()) | 528 if (out_of_process_proxy_.get()) |
| 520 out_of_process_proxy_->AddInstance(instance->pp_instance()); | 529 out_of_process_proxy_->AddInstance(instance->pp_instance()); |
| 521 return instance; | 530 return instance; |
| 522 } | 531 } |
| 523 | 532 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 601 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
| 593 if (retval != 0) { | 602 if (retval != 0) { |
| 594 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 603 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
| 595 return false; | 604 return false; |
| 596 } | 605 } |
| 597 return true; | 606 return true; |
| 598 } | 607 } |
| 599 | 608 |
| 600 } // namespace ppapi | 609 } // namespace ppapi |
| 601 } // namespace webkit | 610 } // namespace webkit |
| OLD | NEW |