From 67f92bc3e4a932b3a12693c0517653f08af87a83 Mon Sep 17 00:00:00 2001 From: "fischman@chromium.org" Date: Thu, 26 Jan 2012 01:56:19 +0000 Subject: Convert all remaining explicit LeakyLazyInstanceTraits users to ::Leaky and hide LeakyLazyInstanceTraits in base::internal to discourage cargo-culting new users. BUG=none TEST=none Review URL: http://codereview.chromium.org/9117038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119173 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/browser_thread_impl.cc | 3 +-- content/browser/browsing_instance.cc | 7 ++----- content/browser/browsing_instance.h | 8 +++----- content/browser/debugger/devtools_http_handler_impl.cc | 18 ++++++------------ .../debugger/render_view_devtools_agent_host.cc | 7 ++----- content/browser/net/url_request_slow_download_job.cc | 7 ++----- content/browser/net/url_request_slow_download_job.h | 6 ++---- content/browser/renderer_host/java/java_method.cc | 3 ++- .../browser/renderer_host/render_process_host_impl.cc | 6 ++---- content/common/np_channel_base.cc | 8 +++----- content/common/socket_stream_dispatcher.cc | 14 +++++--------- content/renderer/devtools_agent.cc | 4 ++-- .../gpu/webgraphicscontext3d_command_buffer_impl.cc | 3 +-- content/renderer/indexed_db/indexed_db_dispatcher.cc | 7 +++---- 14 files changed, 36 insertions(+), 65 deletions(-) (limited to 'content') diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index bd6aff9..0814a3c 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc @@ -56,8 +56,7 @@ struct BrowserThreadGlobals { base::SequencedWorkerPool* blocking_pool; }; -base::LazyInstance > +base::LazyInstance::Leaky g_globals = LAZY_INSTANCE_INITIALIZER; } // namespace diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc index a03d873..b82ef96 100644 --- a/content/browser/browsing_instance.cc +++ b/content/browser/browsing_instance.cc @@ -16,11 +16,8 @@ using content::SiteInstance; // static -base::LazyInstance< - BrowsingInstance::ContextSiteInstanceMap, - base::LeakyLazyInstanceTraits > - BrowsingInstance::context_site_instance_map_ = - LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::Leaky + BrowsingInstance::context_site_instance_map_ = LAZY_INSTANCE_INITIALIZER; BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) : browser_context_(browser_context) { diff --git a/content/browser/browsing_instance.h b/content/browser/browsing_instance.h index f32b3d5..9347c90 100644 --- a/content/browser/browsing_instance.h +++ b/content/browser/browsing_instance.h @@ -10,12 +10,12 @@ #include "base/lazy_instance.h" #include "base/memory/ref_counted.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_context.h" class GURL; class SiteInstanceImpl; namespace content { -class BrowserContext; class SiteInstance; } @@ -137,10 +137,8 @@ class CONTENT_EXPORT BrowsingInstance SiteInstanceMap site_instance_map_; // Global map of BrowserContext to SiteInstanceMap, for process-per-site. - static base::LazyInstance< - ContextSiteInstanceMap, - base::LeakyLazyInstanceTraits > - context_site_instance_map_; + static base::LazyInstance::Leaky + context_site_instance_map_; DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); }; diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc index 6661e94..6d0bc99 100644 --- a/content/browser/debugger/devtools_http_handler_impl.cc +++ b/content/browser/debugger/devtools_http_handler_impl.cc @@ -116,23 +116,17 @@ class TabContentsIDHelper : public content::WebContentsObserver { int id_; typedef std::map IdToTabContentsMap; - static base::LazyInstance > + static base::LazyInstance::Leaky id_to_tabcontents_; typedef std::map TabContentsToIdMap; - static base::LazyInstance > + static base::LazyInstance::Leaky tabcontents_to_id_; }; -base::LazyInstance< - TabContentsIDHelper::IdToTabContentsMap, - base::LeakyLazyInstanceTraits > - TabContentsIDHelper::id_to_tabcontents_ = LAZY_INSTANCE_INITIALIZER; -base::LazyInstance< - TabContentsIDHelper::TabContentsToIdMap, - base::LeakyLazyInstanceTraits > - TabContentsIDHelper::tabcontents_to_id_ = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::Leaky + TabContentsIDHelper::id_to_tabcontents_ = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::Leaky + TabContentsIDHelper::tabcontents_to_id_ = LAZY_INSTANCE_INITIALIZER; } // namespace diff --git a/content/browser/debugger/render_view_devtools_agent_host.cc b/content/browser/debugger/render_view_devtools_agent_host.cc index 943930f..54e4c79 100644 --- a/content/browser/debugger/render_view_devtools_agent_host.cc +++ b/content/browser/debugger/render_view_devtools_agent_host.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,9 +23,7 @@ namespace content { typedef std::map Instances; namespace { -base::LazyInstance > - g_instances = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; } // namespace // static @@ -142,4 +140,3 @@ void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { } } // namespace content - diff --git a/content/browser/net/url_request_slow_download_job.cc b/content/browser/net/url_request_slow_download_job.cc index 3f01cdf..0ac85b4 100644 --- a/content/browser/net/url_request_slow_download_job.cc +++ b/content/browser/net/url_request_slow_download_job.cc @@ -30,11 +30,8 @@ const int URLRequestSlowDownloadJob::kFirstDownloadSize = 1024 * 35; const int URLRequestSlowDownloadJob::kSecondDownloadSize = 1024 * 10; // static -base::LazyInstance< - URLRequestSlowDownloadJob::SlowJobsSet, - base::LeakyLazyInstanceTraits > - URLRequestSlowDownloadJob::pending_requests_ = - LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::Leaky + URLRequestSlowDownloadJob::pending_requests_ = LAZY_INSTANCE_INITIALIZER; void URLRequestSlowDownloadJob::Start() { MessageLoop::current()->PostTask( diff --git a/content/browser/net/url_request_slow_download_job.h b/content/browser/net/url_request_slow_download_job.h index 5ee6980..842ac9b 100644 --- a/content/browser/net/url_request_slow_download_job.h +++ b/content/browser/net/url_request_slow_download_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. // This class simulates a slow download. This used in a UI test to test the @@ -80,9 +80,7 @@ class URLRequestSlowDownloadJob : public net::URLRequestJob { // requests in |pending_requests_|. static void FinishPendingRequests(); typedef std::set SlowJobsSet; - static base::LazyInstance > - pending_requests_; + static base::LazyInstance::Leaky pending_requests_; void StartAsync(); diff --git a/content/browser/renderer_host/java/java_method.cc b/content/browser/renderer_host/java/java_method.cc index fb4ef80..ee65b87 100644 --- a/content/browser/renderer_host/java/java_method.cc +++ b/content/browser/renderer_host/java/java_method.cc @@ -36,7 +36,8 @@ const char kReturningJavaLangClassArray[] = "()[Ljava/lang/Class;"; const char kReturningJavaLangString[] = "()Ljava/lang/String;"; struct ModifierClassTraits : - public base::LeakyLazyInstanceTraits > { + public base::internal::LeakyLazyInstanceTraits > { static ScopedJavaGlobalRef* New(void* instance) { JNIEnv* env = AttachCurrentThread(); // Use placement new to initialize our instance in our preallocated space. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index e2e921a..38103c9 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -245,10 +245,8 @@ size_t GetMaxRendererProcessCount() { } // the global list of all renderer processes -base::LazyInstance< - IDMap, - base::LeakyLazyInstanceTraits > > - g_all_hosts = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance >::Leaky + g_all_hosts = LAZY_INSTANCE_INITIALIZER; } // namespace diff --git a/content/common/np_channel_base.cc b/content/common/np_channel_base.cc index d830295..4209b0c 100644 --- a/content/common/np_channel_base.cc +++ b/content/common/np_channel_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -17,13 +17,11 @@ #endif typedef base::hash_map > ChannelMap; -static base::LazyInstance > +static base::LazyInstance::Leaky g_channels = LAZY_INSTANCE_INITIALIZER; typedef std::stack > NPChannelRefStack; -static base::LazyInstance > +static base::LazyInstance::Leaky g_lazy_channel_stack = LAZY_INSTANCE_INITIALIZER; static int next_pipe_id = 0; diff --git a/content/common/socket_stream_dispatcher.cc b/content/common/socket_stream_dispatcher.cc index a45a3f5..d2a332f 100644 --- a/content/common/socket_stream_dispatcher.cc +++ b/content/common/socket_stream_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -57,17 +57,13 @@ class IPCWebSocketStreamHandleBridge WebKit::WebSocketStreamHandle* handle_; webkit_glue::WebSocketStreamHandleDelegate* delegate_; - static base::LazyInstance< - IDMap, - base::LeakyLazyInstanceTraits > > - all_bridges; + static base::LazyInstance >::Leaky + all_bridges; }; // static -base::LazyInstance< - IDMap, - base::LeakyLazyInstanceTraits > > - IPCWebSocketStreamHandleBridge::all_bridges = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance >::Leaky + IPCWebSocketStreamHandleBridge::all_bridges = LAZY_INSTANCE_INITIALIZER; /* static */ IPCWebSocketStreamHandleBridge* IPCWebSocketStreamHandleBridge::FromSocketId( diff --git a/content/renderer/devtools_agent.cc b/content/renderer/devtools_agent.cc index 68a4b0e..c596a83 100644 --- a/content/renderer/devtools_agent.cc +++ b/content/renderer/devtools_agent.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -51,7 +51,7 @@ class WebKitClientMessageLoopImpl }; typedef std::map IdToAgentMap; -base::LazyInstance > +base::LazyInstance::Leaky g_agent_for_routing_id = LAZY_INSTANCE_INITIALIZER; } // namespace diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc index 2f3b51f..37ab0fe 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc @@ -37,8 +37,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" -static base::LazyInstance > +static base::LazyInstance::Leaky g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; static base::LazyInstance > g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; diff --git a/content/renderer/indexed_db/indexed_db_dispatcher.cc b/content/renderer/indexed_db/indexed_db_dispatcher.cc index 7ec0703..2770fbb 100644 --- a/content/renderer/indexed_db/indexed_db_dispatcher.cc +++ b/content/renderer/indexed_db/indexed_db_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -33,9 +33,8 @@ using WebKit::WebIDBTransaction; using WebKit::WebIDBTransactionCallbacks; using webkit_glue::WorkerTaskRunner; -static base::LazyInstance, - base::LeakyLazyInstanceTraits > > - g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance >::Leaky + g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; namespace { -- cgit v1.1