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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 callback_tracker_->AbortAll(); | 471 callback_tracker_->AbortAll(); |
472 | 472 |
473 if (entry_points_.shutdown_module) | 473 if (entry_points_.shutdown_module) |
474 entry_points_.shutdown_module(); | 474 entry_points_.shutdown_module(); |
475 | 475 |
476 if (library_) | 476 if (library_) |
477 base::UnloadNativeLibrary(library_); | 477 base::UnloadNativeLibrary(library_); |
478 | 478 |
479 // Notifications that we've been deleted should be last. | 479 // Notifications that we've been deleted should be last. |
480 HostGlobals::Get()->ModuleDeleted(pp_module_); | 480 HostGlobals::Get()->ModuleDeleted(pp_module_); |
481 if (!is_crashed_) { | 481 if (!is_crashed_ && lifetime_delegate_) { |
482 // When the plugin crashes, we immediately tell the lifetime delegate that | 482 // When the plugin crashes, we immediately tell the lifetime delegate that |
483 // we're gone, so we don't want to tell it again. | 483 // we're gone, so we don't want to tell it again. |
484 lifetime_delegate_->PluginModuleDead(this); | 484 lifetime_delegate_->PluginModuleDead(this); |
485 } | 485 } |
486 | 486 |
487 // Don't add stuff here, the two notifications that the module object has | 487 // Don't add stuff here, the two notifications that the module object has |
488 // been deleted should be last. This allows, for example, | 488 // been deleted should be last. This allows, for example, |
489 // PPB_Proxy.IsInModuleDestructor to map PP_Module to this class during the | 489 // PPB_Proxy.IsInModuleDestructor to map PP_Module to this class during the |
490 // previous parts of the destructor. | 490 // previous parts of the destructor. |
491 } | 491 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 void PluginModule::PluginCrashed() { | 583 void PluginModule::PluginCrashed() { |
584 DCHECK(!is_crashed_); // Should only get one notification. | 584 DCHECK(!is_crashed_); // Should only get one notification. |
585 is_crashed_ = true; | 585 is_crashed_ = true; |
586 | 586 |
587 // Notify all instances that they crashed. | 587 // Notify all instances that they crashed. |
588 for (PluginInstanceSet::iterator i = instances_.begin(); | 588 for (PluginInstanceSet::iterator i = instances_.begin(); |
589 i != instances_.end(); ++i) | 589 i != instances_.end(); ++i) |
590 (*i)->InstanceCrashed(); | 590 (*i)->InstanceCrashed(); |
591 | 591 |
592 lifetime_delegate_->PluginModuleDead(this); | 592 if (lifetime_delegate_) |
| 593 lifetime_delegate_->PluginModuleDead(this); |
593 } | 594 } |
594 | 595 |
595 void PluginModule::SetReserveInstanceIDCallback( | 596 void PluginModule::SetReserveInstanceIDCallback( |
596 PP_Bool (*reserve)(PP_Module, PP_Instance)) { | 597 PP_Bool (*reserve)(PP_Module, PP_Instance)) { |
597 DCHECK(!reserve_instance_id_) << "Only expect one set."; | 598 DCHECK(!reserve_instance_id_) << "Only expect one set."; |
598 reserve_instance_id_ = reserve; | 599 reserve_instance_id_ = reserve; |
599 } | 600 } |
600 | 601 |
601 bool PluginModule::ReserveInstanceID(PP_Instance instance) { | 602 bool PluginModule::ReserveInstanceID(PP_Instance instance) { |
602 if (reserve_instance_id_) | 603 if (reserve_instance_id_) |
(...skipping 16 matching lines...) Expand all Loading... |
619 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 620 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
620 if (retval != 0) { | 621 if (retval != 0) { |
621 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 622 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
622 return false; | 623 return false; |
623 } | 624 } |
624 return true; | 625 return true; |
625 } | 626 } |
626 | 627 |
627 } // namespace ppapi | 628 } // namespace ppapi |
628 } // namespace webkit | 629 } // namespace webkit |
OLD | NEW |