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

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

Issue 9006055: Move the tracked completion callback code into shared impl. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "ppapi/c/private/ppb_uma_private.h" 77 #include "ppapi/c/private/ppb_uma_private.h"
78 #include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h" 78 #include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h"
79 #include "ppapi/c/trusted/ppb_audio_trusted.h" 79 #include "ppapi/c/trusted/ppb_audio_trusted.h"
80 #include "ppapi/c/trusted/ppb_broker_trusted.h" 80 #include "ppapi/c/trusted/ppb_broker_trusted.h"
81 #include "ppapi/c/trusted/ppb_buffer_trusted.h" 81 #include "ppapi/c/trusted/ppb_buffer_trusted.h"
82 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" 82 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
83 #include "ppapi/c/trusted/ppb_file_io_trusted.h" 83 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
84 #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h" 84 #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
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/ppb_input_event_shared.h" 88 #include "ppapi/shared_impl/ppb_input_event_shared.h"
88 #include "ppapi/shared_impl/ppb_opengles2_shared.h" 89 #include "ppapi/shared_impl/ppb_opengles2_shared.h"
89 #include "ppapi/shared_impl/ppb_var_shared.h" 90 #include "ppapi/shared_impl/ppb_var_shared.h"
90 #include "ppapi/shared_impl/time_conversion.h" 91 #include "ppapi/shared_impl/time_conversion.h"
91 #include "ppapi/thunk/enter.h" 92 #include "ppapi/thunk/enter.h"
92 #include "ppapi/thunk/thunk.h" 93 #include "ppapi/thunk/thunk.h"
93 #include "webkit/plugins/plugin_switches.h" 94 #include "webkit/plugins/plugin_switches.h"
94 #include "webkit/plugins/ppapi/callbacks.h" 95 #include "webkit/plugins/ppapi/callbacks.h"
95 #include "webkit/plugins/ppapi/common.h" 96 #include "webkit/plugins/ppapi/common.h"
96 #include "webkit/plugins/ppapi/host_globals.h" 97 #include "webkit/plugins/ppapi/host_globals.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 initialize_module(NULL), 409 initialize_module(NULL),
409 shutdown_module(NULL) { 410 shutdown_module(NULL) {
410 } 411 }
411 412
412 // PluginModule ---------------------------------------------------------------- 413 // PluginModule ----------------------------------------------------------------
413 414
414 PluginModule::PluginModule(const std::string& name, 415 PluginModule::PluginModule(const std::string& name,
415 const FilePath& path, 416 const FilePath& path,
416 PluginDelegate::ModuleLifetime* lifetime_delegate) 417 PluginDelegate::ModuleLifetime* lifetime_delegate)
417 : lifetime_delegate_(lifetime_delegate), 418 : lifetime_delegate_(lifetime_delegate),
418 callback_tracker_(new CallbackTracker), 419 old_callback_tracker_(new CallbackTracker),
420 callback_tracker_(new ::ppapi::CallbackTracker),
419 is_in_destructor_(false), 421 is_in_destructor_(false),
420 is_crashed_(false), 422 is_crashed_(false),
421 broker_(NULL), 423 broker_(NULL),
422 library_(NULL), 424 library_(NULL),
423 name_(name), 425 name_(name),
424 path_(path), 426 path_(path),
425 reserve_instance_id_(NULL) { 427 reserve_instance_id_(NULL) {
426 // Ensure the globals object is created. 428 // Ensure the globals object is created.
427 if (!host_globals) 429 if (!host_globals)
428 host_globals = new HostGlobals; 430 host_globals = new HostGlobals;
429 431
430 memset(&entry_points_, 0, sizeof(entry_points_)); 432 memset(&entry_points_, 0, sizeof(entry_points_));
431 pp_module_ = HostGlobals::Get()->AddModule(this); 433 pp_module_ = HostGlobals::Get()->AddModule(this);
432 GetMainThreadMessageLoop(); // Initialize the main thread message loop. 434 GetMainThreadMessageLoop(); // Initialize the main thread message loop.
433 GetLivePluginSet()->insert(this); 435 GetLivePluginSet()->insert(this);
434 } 436 }
435 437
436 PluginModule::~PluginModule() { 438 PluginModule::~PluginModule() {
437 // In the past there have been crashes reentering the plugin module 439 // In the past there have been crashes reentering the plugin module
438 // destructor. Catch if that happens again earlier. 440 // destructor. Catch if that happens again earlier.
439 CHECK(!is_in_destructor_); 441 CHECK(!is_in_destructor_);
440 is_in_destructor_ = true; 442 is_in_destructor_ = true;
441 443
442 // When the module is being deleted, there should be no more instances still 444 // When the module is being deleted, there should be no more instances still
443 // holding a reference to us. 445 // holding a reference to us.
444 DCHECK(instances_.empty()); 446 DCHECK(instances_.empty());
445 447
446 GetLivePluginSet()->erase(this); 448 GetLivePluginSet()->erase(this);
447 449
450 old_callback_tracker_->AbortAll();
448 callback_tracker_->AbortAll(); 451 callback_tracker_->AbortAll();
449 452
450 if (entry_points_.shutdown_module) 453 if (entry_points_.shutdown_module)
451 entry_points_.shutdown_module(); 454 entry_points_.shutdown_module();
452 455
453 if (library_) 456 if (library_)
454 base::UnloadNativeLibrary(library_); 457 base::UnloadNativeLibrary(library_);
455 458
456 // Notifications that we've been deleted should be last. 459 // Notifications that we've been deleted should be last.
457 HostGlobals::Get()->ModuleDeleted(pp_module_); 460 HostGlobals::Get()->ModuleDeleted(pp_module_);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 instances_.insert(instance); 546 instances_.insert(instance);
544 } 547 }
545 548
546 void PluginModule::InstanceDeleted(PluginInstance* instance) { 549 void PluginModule::InstanceDeleted(PluginInstance* instance) {
547 if (out_of_process_proxy_.get()) 550 if (out_of_process_proxy_.get())
548 out_of_process_proxy_->RemoveInstance(instance->pp_instance()); 551 out_of_process_proxy_->RemoveInstance(instance->pp_instance());
549 instances_.erase(instance); 552 instances_.erase(instance);
550 } 553 }
551 554
552 scoped_refptr<CallbackTracker> PluginModule::GetCallbackTracker() { 555 scoped_refptr<CallbackTracker> PluginModule::GetCallbackTracker() {
556 return old_callback_tracker_;
557 }
558
559 scoped_refptr< ::ppapi::CallbackTracker> PluginModule::GetNewCallbackTracker() {
553 return callback_tracker_; 560 return callback_tracker_;
554 } 561 }
555 562
556 void PluginModule::PluginCrashed() { 563 void PluginModule::PluginCrashed() {
557 DCHECK(!is_crashed_); // Should only get one notification. 564 DCHECK(!is_crashed_); // Should only get one notification.
558 is_crashed_ = true; 565 is_crashed_ = true;
559 566
560 // Notify all instances that they crashed. 567 // Notify all instances that they crashed.
561 for (PluginInstanceSet::iterator i = instances_.begin(); 568 for (PluginInstanceSet::iterator i = instances_.begin();
562 i != instances_.end(); ++i) 569 i != instances_.end(); ++i)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 int retval = entry_points.initialize_module(pp_module(), &GetInterface); 605 int retval = entry_points.initialize_module(pp_module(), &GetInterface);
599 if (retval != 0) { 606 if (retval != 0) {
600 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 607 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
601 return false; 608 return false;
602 } 609 }
603 return true; 610 return true;
604 } 611 }
605 612
606 } // namespace ppapi 613 } // namespace ppapi
607 } // namespace webkit 614 } // namespace webkit
OLDNEW
« ppapi/shared_impl/tracked_callback_unittest.cc ('K') | « webkit/plugins/ppapi/plugin_module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698