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

Unified Diff: webkit/appcache/web_application_cache_host_impl.cc

Issue 7756015: Get rid of a LazyInstance usage to get rid of code execution at static init time. This doesn't ne... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/web_application_cache_host_impl.cc
===================================================================
--- webkit/appcache/web_application_cache_host_impl.cc (revision 99019)
+++ webkit/appcache/web_application_cache_host_impl.cc (working copy)
@@ -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 {
-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 @@
"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 @@
} // 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 @@
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() {
backend_->UnregisterHost(host_id_);
- g_hosts_map.Get().Remove(host_id_);
+ all_hosts()->Remove(host_id_);
}
void WebApplicationCacheHostImpl::OnCacheSelected(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698