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

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

Issue 9015009: Use the new callback tracker and delete the old one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add IsPending Created 8 years, 11 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/ppb_broker_impl.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "ppapi/c/trusted/ppb_image_data_trusted.h" 85 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
86 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" 86 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
87 #include "ppapi/shared_impl/callback_tracker.h" 87 #include "ppapi/shared_impl/callback_tracker.h"
88 #include "ppapi/shared_impl/ppb_input_event_shared.h" 88 #include "ppapi/shared_impl/ppb_input_event_shared.h"
89 #include "ppapi/shared_impl/ppb_opengles2_shared.h" 89 #include "ppapi/shared_impl/ppb_opengles2_shared.h"
90 #include "ppapi/shared_impl/ppb_var_shared.h" 90 #include "ppapi/shared_impl/ppb_var_shared.h"
91 #include "ppapi/shared_impl/time_conversion.h" 91 #include "ppapi/shared_impl/time_conversion.h"
92 #include "ppapi/thunk/enter.h" 92 #include "ppapi/thunk/enter.h"
93 #include "ppapi/thunk/thunk.h" 93 #include "ppapi/thunk/thunk.h"
94 #include "webkit/plugins/plugin_switches.h" 94 #include "webkit/plugins/plugin_switches.h"
95 #include "webkit/plugins/ppapi/callbacks.h"
96 #include "webkit/plugins/ppapi/common.h" 95 #include "webkit/plugins/ppapi/common.h"
97 #include "webkit/plugins/ppapi/host_globals.h" 96 #include "webkit/plugins/ppapi/host_globals.h"
98 #include "webkit/plugins/ppapi/host_resource_tracker.h"
99 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" 97 #include "webkit/plugins/ppapi/ppapi_interface_factory.h"
100 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 98 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
101 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" 99 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
102 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" 100 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h"
103 #include "webkit/plugins/ppapi/ppb_flash_file_impl.h" 101 #include "webkit/plugins/ppapi/ppb_flash_file_impl.h"
104 #include "webkit/plugins/ppapi/ppb_flash_impl.h" 102 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
105 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" 103 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h"
106 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" 104 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h"
107 #include "webkit/plugins/ppapi/ppb_font_impl.h" 105 #include "webkit/plugins/ppapi/ppb_font_impl.h"
108 #include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h" 106 #include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 MessageLoop::current()->SetNestableTasksAllowed(true); 211 MessageLoop::current()->SetNestableTasksAllowed(true);
214 MessageLoop::current()->Run(); 212 MessageLoop::current()->Run();
215 MessageLoop::current()->SetNestableTasksAllowed(old_state); 213 MessageLoop::current()->SetNestableTasksAllowed(old_state);
216 } 214 }
217 215
218 void QuitMessageLoop(PP_Instance instance) { 216 void QuitMessageLoop(PP_Instance instance) {
219 MessageLoop::current()->QuitNow(); 217 MessageLoop::current()->QuitNow();
220 } 218 }
221 219
222 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { 220 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
223 return HostGlobals::Get()->host_resource_tracker()->GetLiveObjectsForInstance( 221 return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance(
224 instance_id); 222 instance_id);
225 } 223 }
226 224
227 PP_Bool IsOutOfProcess() { 225 PP_Bool IsOutOfProcess() {
228 return PP_FALSE; 226 return PP_FALSE;
229 } 227 }
230 228
231 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { 229 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
232 PluginInstance* plugin_instance = host_globals->GetInstance(instance); 230 PluginInstance* plugin_instance = host_globals->GetInstance(instance);
233 if (!plugin_instance) 231 if (!plugin_instance)
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 initialize_module(NULL), 407 initialize_module(NULL),
410 shutdown_module(NULL) { 408 shutdown_module(NULL) {
411 } 409 }
412 410
413 // PluginModule ---------------------------------------------------------------- 411 // PluginModule ----------------------------------------------------------------
414 412
415 PluginModule::PluginModule(const std::string& name, 413 PluginModule::PluginModule(const std::string& name,
416 const FilePath& path, 414 const FilePath& path,
417 PluginDelegate::ModuleLifetime* lifetime_delegate) 415 PluginDelegate::ModuleLifetime* lifetime_delegate)
418 : lifetime_delegate_(lifetime_delegate), 416 : lifetime_delegate_(lifetime_delegate),
419 old_callback_tracker_(new CallbackTracker),
420 callback_tracker_(new ::ppapi::CallbackTracker), 417 callback_tracker_(new ::ppapi::CallbackTracker),
421 is_in_destructor_(false), 418 is_in_destructor_(false),
422 is_crashed_(false), 419 is_crashed_(false),
423 broker_(NULL), 420 broker_(NULL),
424 library_(NULL), 421 library_(NULL),
425 name_(name), 422 name_(name),
426 path_(path), 423 path_(path),
427 reserve_instance_id_(NULL) { 424 reserve_instance_id_(NULL) {
428 // Ensure the globals object is created. 425 // Ensure the globals object is created.
429 if (!host_globals) 426 if (!host_globals)
(...skipping 10 matching lines...) Expand all
440 // destructor. Catch if that happens again earlier. 437 // destructor. Catch if that happens again earlier.
441 CHECK(!is_in_destructor_); 438 CHECK(!is_in_destructor_);
442 is_in_destructor_ = true; 439 is_in_destructor_ = true;
443 440
444 // When the module is being deleted, there should be no more instances still 441 // When the module is being deleted, there should be no more instances still
445 // holding a reference to us. 442 // holding a reference to us.
446 DCHECK(instances_.empty()); 443 DCHECK(instances_.empty());
447 444
448 GetLivePluginSet()->erase(this); 445 GetLivePluginSet()->erase(this);
449 446
450 old_callback_tracker_->AbortAll();
451 callback_tracker_->AbortAll(); 447 callback_tracker_->AbortAll();
452 448
453 if (entry_points_.shutdown_module) 449 if (entry_points_.shutdown_module)
454 entry_points_.shutdown_module(); 450 entry_points_.shutdown_module();
455 451
456 if (library_) 452 if (library_)
457 base::UnloadNativeLibrary(library_); 453 base::UnloadNativeLibrary(library_);
458 454
459 // Notifications that we've been deleted should be last. 455 // Notifications that we've been deleted should be last.
460 HostGlobals::Get()->ModuleDeleted(pp_module_); 456 HostGlobals::Get()->ModuleDeleted(pp_module_);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 void PluginModule::InstanceCreated(PluginInstance* instance) { 541 void PluginModule::InstanceCreated(PluginInstance* instance) {
546 instances_.insert(instance); 542 instances_.insert(instance);
547 } 543 }
548 544
549 void PluginModule::InstanceDeleted(PluginInstance* instance) { 545 void PluginModule::InstanceDeleted(PluginInstance* instance) {
550 if (out_of_process_proxy_.get()) 546 if (out_of_process_proxy_.get())
551 out_of_process_proxy_->RemoveInstance(instance->pp_instance()); 547 out_of_process_proxy_->RemoveInstance(instance->pp_instance());
552 instances_.erase(instance); 548 instances_.erase(instance);
553 } 549 }
554 550
555 scoped_refptr<CallbackTracker> PluginModule::GetCallbackTracker() { 551 scoped_refptr< ::ppapi::CallbackTracker> PluginModule::GetCallbackTracker() {
556 return old_callback_tracker_;
557 }
558
559 scoped_refptr< ::ppapi::CallbackTracker> PluginModule::GetNewCallbackTracker() {
560 return callback_tracker_; 552 return callback_tracker_;
561 } 553 }
562 554
563 void PluginModule::PluginCrashed() { 555 void PluginModule::PluginCrashed() {
564 DCHECK(!is_crashed_); // Should only get one notification. 556 DCHECK(!is_crashed_); // Should only get one notification.
565 is_crashed_ = true; 557 is_crashed_ = true;
566 558
567 // Notify all instances that they crashed. 559 // Notify all instances that they crashed.
568 for (PluginInstanceSet::iterator i = instances_.begin(); 560 for (PluginInstanceSet::iterator i = instances_.begin();
569 i != instances_.end(); ++i) 561 i != instances_.end(); ++i)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 int retval = entry_points.initialize_module(pp_module(), &GetInterface); 597 int retval = entry_points.initialize_module(pp_module(), &GetInterface);
606 if (retval != 0) { 598 if (retval != 0) {
607 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 599 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
608 return false; 600 return false;
609 } 601 }
610 return true; 602 return true;
611 } 603 }
612 604
613 } // namespace ppapi 605 } // namespace ppapi
614 } // namespace webkit 606 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('k') | webkit/plugins/ppapi/ppb_broker_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698