diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-05 21:44:31 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-05 21:44:31 +0000 |
commit | bbf4467a11440950f05432d3d68495c61e5623c6 (patch) | |
tree | 85a36cf931af16547a5022e2b9d6bfed76473726 /webkit | |
parent | aee4313f4c8d0fc0ffc64aa8175a89879c25528a (diff) | |
download | chromium_src-bbf4467a11440950f05432d3d68495c61e5623c6.zip chromium_src-bbf4467a11440950f05432d3d68495c61e5623c6.tar.gz chromium_src-bbf4467a11440950f05432d3d68495c61e5623c6.tar.bz2 |
Re-land more changes from r73427 where we set the name for each module in the constructor (checking for perf regressions).
Review URL: http://codereview.chromium.org/6312177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.h | 9 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_unittest.cc | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 332770ff..a8d804a 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -360,10 +360,12 @@ PluginModule::EntryPoints::EntryPoints() // PluginModule ---------------------------------------------------------------- -PluginModule::PluginModule(PluginDelegate::ModuleLifetime* lifetime_delegate) +PluginModule::PluginModule(const std::string& name, + PluginDelegate::ModuleLifetime* lifetime_delegate) : lifetime_delegate_(lifetime_delegate), callback_tracker_(new CallbackTracker), - library_(NULL) { + library_(NULL), + name_(name) { pp_module_ = ResourceTracker::Get()->AddModule(this); GetMainThreadMessageLoop(); // Initialize the main thread message loop. GetLivePluginSet()->insert(this); diff --git a/webkit/plugins/ppapi/plugin_module.h b/webkit/plugins/ppapi/plugin_module.h index cfdfb6af..4f3e9c3 100644 --- a/webkit/plugins/ppapi/plugin_module.h +++ b/webkit/plugins/ppapi/plugin_module.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include <map> #include <set> +#include <string> #include "base/basictypes.h" #include "base/native_library.h" @@ -71,7 +72,8 @@ class PluginModule : public base::RefCounted<PluginModule>, // The module lifetime delegate is a non-owning pointer that must outlive // all plugin modules. In practice it will be a global singleton that // tracks which modules are alive. - PluginModule(PluginDelegate::ModuleLifetime* lifetime_delegate); + PluginModule(const std::string& name, + PluginDelegate::ModuleLifetime* lifetime_delegate); ~PluginModule(); @@ -98,7 +100,6 @@ class PluginModule : public base::RefCounted<PluginModule>, // proxy needs this information to set itself up properly). PP_Module pp_module() const { return pp_module_; } - void set_name(const std::string& name) { name_ = name; } const std::string& name() const { return name_; } PluginInstance* CreateInstance(PluginDelegate* delegate); @@ -152,7 +153,7 @@ class PluginModule : public base::RefCounted<PluginModule>, EntryPoints entry_points_; // The name of the module. - std::string name_; + const std::string name_; // Non-owning pointers to all instances associated with this module. When // there are no more instances, this object should be deleted. diff --git a/webkit/plugins/ppapi/ppapi_unittest.cc b/webkit/plugins/ppapi/ppapi_unittest.cc index 7ad58c3..a9a3637 100644 --- a/webkit/plugins/ppapi/ppapi_unittest.cc +++ b/webkit/plugins/ppapi/ppapi_unittest.cc @@ -87,7 +87,7 @@ void PpapiUnittest::SetUp() { delegate_.reset(new MockPluginDelegate); // Initialize the mock module. - module_ = new PluginModule(this); + module_ = new PluginModule("Mock plugin", this); PluginModule::EntryPoints entry_points; entry_points.get_interface = &MockGetInterface; entry_points.initialize_module = &MockInitializeModule; |