| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 PluginModule::EntryPoints::EntryPoints() | 393 PluginModule::EntryPoints::EntryPoints() |
| 394 : get_interface(NULL), | 394 : get_interface(NULL), |
| 395 initialize_module(NULL), | 395 initialize_module(NULL), |
| 396 shutdown_module(NULL) { | 396 shutdown_module(NULL) { |
| 397 } | 397 } |
| 398 | 398 |
| 399 // PluginModule ---------------------------------------------------------------- | 399 // PluginModule ---------------------------------------------------------------- |
| 400 | 400 |
| 401 PluginModule::PluginModule(const std::string& name, | 401 PluginModule::PluginModule(const std::string& name, |
| 402 const std::string& version, |
| 402 const FilePath& path, | 403 const FilePath& path, |
| 403 PluginDelegate::ModuleLifetime* lifetime_delegate, | 404 PluginDelegate::ModuleLifetime* lifetime_delegate, |
| 404 const ::ppapi::PpapiPermissions& perms) | 405 const ::ppapi::PpapiPermissions& perms) |
| 405 : lifetime_delegate_(lifetime_delegate), | 406 : lifetime_delegate_(lifetime_delegate), |
| 406 callback_tracker_(new ::ppapi::CallbackTracker), | 407 callback_tracker_(new ::ppapi::CallbackTracker), |
| 407 is_in_destructor_(false), | 408 is_in_destructor_(false), |
| 408 is_crashed_(false), | 409 is_crashed_(false), |
| 409 broker_(NULL), | 410 broker_(NULL), |
| 410 library_(NULL), | 411 library_(NULL), |
| 411 name_(name), | 412 name_(name), |
| 413 version_(version), |
| 412 path_(path), | 414 path_(path), |
| 413 permissions_(perms), | 415 permissions_(perms), |
| 414 reserve_instance_id_(NULL) { | 416 reserve_instance_id_(NULL) { |
| 415 // Ensure the globals object is created. | 417 // Ensure the globals object is created. |
| 416 if (!host_globals) | 418 if (!host_globals) |
| 417 host_globals = new HostGlobals; | 419 host_globals = new HostGlobals; |
| 418 | 420 |
| 419 memset(&entry_points_, 0, sizeof(entry_points_)); | 421 memset(&entry_points_, 0, sizeof(entry_points_)); |
| 420 pp_module_ = HostGlobals::Get()->AddModule(this); | 422 pp_module_ = HostGlobals::Get()->AddModule(this); |
| 421 GetLivePluginSet()->insert(this); | 423 GetLivePluginSet()->insert(this); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) { | 494 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) { |
| 493 DCHECK(!out_of_process_proxy_.get()); | 495 DCHECK(!out_of_process_proxy_.get()); |
| 494 out_of_process_proxy_.reset(out_of_process_proxy); | 496 out_of_process_proxy_.reset(out_of_process_proxy); |
| 495 } | 497 } |
| 496 | 498 |
| 497 scoped_refptr<PluginModule> PluginModule::CreateModuleForNaClInstance() { | 499 scoped_refptr<PluginModule> PluginModule::CreateModuleForNaClInstance() { |
| 498 // Create a new module, but don't set the lifetime delegate. This isn't a | 500 // Create a new module, but don't set the lifetime delegate. This isn't a |
| 499 // plugin in the usual sense, so it isn't tracked by the browser. | 501 // plugin in the usual sense, so it isn't tracked by the browser. |
| 500 scoped_refptr<PluginModule> nacl_module( | 502 scoped_refptr<PluginModule> nacl_module( |
| 501 new PluginModule(name_, | 503 new PluginModule(name_, |
| 504 version_, |
| 502 path_, | 505 path_, |
| 503 NULL, // no lifetime_delegate | 506 NULL, // no lifetime_delegate |
| 504 permissions_)); | 507 permissions_)); |
| 505 return nacl_module; | 508 return nacl_module; |
| 506 } | 509 } |
| 507 | 510 |
| 508 PP_NaClResult PluginModule::InitAsProxiedNaCl(PluginInstance* instance) { | 511 PP_NaClResult PluginModule::InitAsProxiedNaCl(PluginInstance* instance) { |
| 509 DCHECK(out_of_process_proxy_.get()); | 512 DCHECK(out_of_process_proxy_.get()); |
| 510 // InitAsProxied (for the trusted/out-of-process case) initializes only the | 513 // InitAsProxied (for the trusted/out-of-process case) initializes only the |
| 511 // module, and one or more instances are added later. In this case, the | 514 // module, and one or more instances are added later. In this case, the |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 626 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
| 624 if (retval != 0) { | 627 if (retval != 0) { |
| 625 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 628 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
| 626 return false; | 629 return false; |
| 627 } | 630 } |
| 628 return true; | 631 return true; |
| 629 } | 632 } |
| 630 | 633 |
| 631 } // namespace ppapi | 634 } // namespace ppapi |
| 632 } // namespace webkit | 635 } // namespace webkit |
| OLD | NEW |