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

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

Issue 6628019: Ensure that PP_Instance values are unique within a plugin process in addition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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_proxy_impl.cc » ('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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 376
377 // PluginModule ---------------------------------------------------------------- 377 // PluginModule ----------------------------------------------------------------
378 378
379 PluginModule::PluginModule(const std::string& name, 379 PluginModule::PluginModule(const std::string& name,
380 PluginDelegate::ModuleLifetime* lifetime_delegate) 380 PluginDelegate::ModuleLifetime* lifetime_delegate)
381 : lifetime_delegate_(lifetime_delegate), 381 : lifetime_delegate_(lifetime_delegate),
382 callback_tracker_(new CallbackTracker), 382 callback_tracker_(new CallbackTracker),
383 is_crashed_(false), 383 is_crashed_(false),
384 library_(NULL), 384 library_(NULL),
385 name_(name) { 385 name_(name),
386 reserve_instance_id_(NULL) {
386 pp_module_ = ResourceTracker::Get()->AddModule(this); 387 pp_module_ = ResourceTracker::Get()->AddModule(this);
387 GetMainThreadMessageLoop(); // Initialize the main thread message loop. 388 GetMainThreadMessageLoop(); // Initialize the main thread message loop.
388 GetLivePluginSet()->insert(this); 389 GetLivePluginSet()->insert(this);
389 } 390 }
390 391
391 PluginModule::~PluginModule() { 392 PluginModule::~PluginModule() {
392 // When the module is being deleted, there should be no more instances still 393 // When the module is being deleted, there should be no more instances still
393 // holding a reference to us. 394 // holding a reference to us.
394 DCHECK(instances_.empty()); 395 DCHECK(instances_.empty());
395 396
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 is_crashed_ = true; 499 is_crashed_ = true;
499 500
500 // Notify all instances that they crashed. 501 // Notify all instances that they crashed.
501 for (PluginInstanceSet::iterator i = instances_.begin(); 502 for (PluginInstanceSet::iterator i = instances_.begin();
502 i != instances_.end(); ++i) 503 i != instances_.end(); ++i)
503 (*i)->InstanceCrashed(); 504 (*i)->InstanceCrashed();
504 505
505 lifetime_delegate_->PluginModuleDead(this); 506 lifetime_delegate_->PluginModuleDead(this);
506 } 507 }
507 508
509 void PluginModule::SetReserveInstanceIDCallback(
510 PP_Bool (*reserve)(PP_Module, PP_Instance)) {
511 DCHECK(!reserve_instance_id_) << "Only expect one set.";
512 reserve_instance_id_ = reserve;
513 }
514
515 bool PluginModule::ReserveInstanceID(PP_Instance instance) {
516 if (reserve_instance_id_)
517 return PPBoolToBool(reserve_instance_id_(pp_module_, instance));
518 return true; // Instance ID is usable.
519 }
520
508 bool PluginModule::InitializeModule() { 521 bool PluginModule::InitializeModule() {
509 DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules."; 522 DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules.";
510 int retval = entry_points_.initialize_module(pp_module(), &GetInterface); 523 int retval = entry_points_.initialize_module(pp_module(), &GetInterface);
511 if (retval != 0) { 524 if (retval != 0) {
512 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 525 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
513 return false; 526 return false;
514 } 527 }
515 return true; 528 return true;
516 } 529 }
517 530
518 } // namespace ppapi 531 } // namespace ppapi
519 } // namespace webkit 532 } // namespace webkit
520 533
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('k') | webkit/plugins/ppapi/ppb_proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698