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

Unified Diff: chrome/plugin/webplugin_proxy.cc

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/plugin/webplugin_proxy.cc
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 87a4772f28513021fc36f8965be5167433c6e1b5..bb771080baaafccb668d7f0c9356622f8c799893 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -9,13 +9,13 @@
#if defined(OS_WIN)
#include "app/win_util.h"
#endif
+#include "base/lazy_instance.h"
#if defined(OS_MACOSX)
#include "base/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/scoped_handle.h"
#include "base/shared_memory.h"
-#include "base/singleton.h"
#include "build/build_config.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/plugin_messages.h"
@@ -47,9 +47,7 @@ using webkit_glue::WebPluginAcceleratedSurface;
#endif
typedef std::map<CPBrowsingContext, WebPluginProxy*> ContextMap;
-static ContextMap& GetContextMap() {
- return *Singleton<ContextMap>::get();
-}
+static base::LazyInstance<ContextMap> g_context_map(base::LINKER_INITIALIZED);
WebPluginProxy::WebPluginProxy(
PluginChannel* channel,
@@ -93,7 +91,7 @@ WebPluginProxy::WebPluginProxy(
WebPluginProxy::~WebPluginProxy() {
if (cp_browsing_context_)
- GetContextMap().erase(cp_browsing_context_);
+ g_context_map.Get().erase(cp_browsing_context_);
#if defined(USE_X11)
if (windowless_shm_pixmap_ != None)
@@ -271,14 +269,14 @@ CPBrowsingContext WebPluginProxy::GetCPBrowsingContext() {
if (cp_browsing_context_ == 0) {
Send(new PluginHostMsg_GetCPBrowsingContext(route_id_,
&cp_browsing_context_));
- GetContextMap()[cp_browsing_context_] = this;
+ g_context_map.Get()[cp_browsing_context_] = this;
}
return cp_browsing_context_;
}
WebPluginProxy* WebPluginProxy::FromCPBrowsingContext(
CPBrowsingContext context) {
- return GetContextMap()[context];
+ return g_context_map.Get()[context];
}
WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) {

Powered by Google App Engine
This is Rietveld 408576698