diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-06 21:07:29 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-06 21:07:29 +0000 |
commit | 38ea7fc27598da983214c3032a86fb1e07920da8 (patch) | |
tree | 793326da2b7e1be94a0227c2d41ce3ebecb22d64 /webkit/appcache | |
parent | e6de0cca5c7d4c0ab765eb2f87cd28a367562747 (diff) | |
download | chromium_src-38ea7fc27598da983214c3032a86fb1e07920da8.zip chromium_src-38ea7fc27598da983214c3032a86fb1e07920da8.tar.gz chromium_src-38ea7fc27598da983214c3032a86fb1e07920da8.tar.bz2 |
Get rid of a LazyInstance usage to get rid of code execution at static init time. This doesn't need to be thread safe.
BUG=94925
Review URL: http://codereview.chromium.org/7756015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/web_application_cache_host_impl.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc index f6e6336..044b4ca 100644 --- a/webkit/appcache/web_application_cache_host_impl.cc +++ b/webkit/appcache/web_application_cache_host_impl.cc @@ -6,7 +6,6 @@ #include "base/compiler_specific.h" #include "base/id_map.h" -#include "base/lazy_instance.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" @@ -28,9 +27,6 @@ namespace appcache { namespace { -typedef IDMap<WebApplicationCacheHostImpl> HostsMap; -static base::LazyInstance<HostsMap> g_hosts_map(base::LINKER_INITIALIZED); - // Note: the order of the elements in this array must match those // of the EventID enum in appcache_interfaces.h. const char* kEventNames[] = { @@ -38,6 +34,13 @@ const char* kEventNames[] = { "UpdateReady", "Cached", "Obsolete" }; +typedef IDMap<WebApplicationCacheHostImpl> HostsMap; + +HostsMap* all_hosts() { + static HostsMap* map = new HostsMap; + return map; +} + GURL ClearUrlRef(const GURL& url) { if (!url.has_ref()) return url; @@ -49,7 +52,7 @@ GURL ClearUrlRef(const GURL& url) { } // anon namespace WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromId(int id) { - return g_hosts_map.Get().Lookup(id); + return all_hosts()->Lookup(id); } WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromFrame( @@ -68,7 +71,7 @@ WebApplicationCacheHostImpl::WebApplicationCacheHostImpl( AppCacheBackend* backend) : client_(client), backend_(backend), - ALLOW_THIS_IN_INITIALIZER_LIST(host_id_(g_hosts_map.Get().Add(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(host_id_(all_hosts()->Add(this))), status_(UNCACHED), is_scheme_supported_(false), is_get_method_(false), @@ -81,7 +84,7 @@ WebApplicationCacheHostImpl::WebApplicationCacheHostImpl( WebApplicationCacheHostImpl::~WebApplicationCacheHostImpl() { backend_->UnregisterHost(host_id_); - g_hosts_map.Get().Remove(host_id_); + all_hosts()->Remove(host_id_); } void WebApplicationCacheHostImpl::OnCacheSelected( |