diff options
Diffstat (limited to 'chrome/renderer/extensions/bindings_utils.cc')
-rw-r--r-- | chrome/renderer/extensions/bindings_utils.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/renderer/extensions/bindings_utils.cc b/chrome/renderer/extensions/bindings_utils.cc index 5b213c4..4776966 100644 --- a/chrome/renderer/extensions/bindings_utils.cc +++ b/chrome/renderer/extensions/bindings_utils.cc @@ -4,6 +4,7 @@ #include "chrome/renderer/extensions/bindings_utils.h" +#include "base/lazy_instance.h" #include "base/string_split.h" #include "base/string_util.h" #include "chrome/renderer/render_view.h" @@ -21,11 +22,14 @@ struct SingletonData { ContextList contexts; PendingRequestMap pending_requests; }; +static base::LazyInstance<SingletonData> g_singleton_data( + base::LINKER_INITIALIZED); typedef std::map<int, std::string> StringMap; +static base::LazyInstance<StringMap> g_string_map(base::LINKER_INITIALIZED); const char* GetStringResource(int resource_id) { - StringMap* strings = Singleton<StringMap>::get(); + StringMap* strings = g_string_map.Pointer(); StringMap::iterator it = strings->find(resource_id); if (it == strings->end()) { it = strings->insert(std::make_pair( @@ -84,7 +88,7 @@ ContextInfo::ContextInfo(v8::Persistent<v8::Context> context, ContextInfo::~ContextInfo() {} ContextList& GetContexts() { - return Singleton<SingletonData>::get()->contexts; + return g_singleton_data.Get().contexts; } ContextList GetContextsForExtension(const std::string& extension_id) { @@ -134,7 +138,7 @@ ContextList::iterator FindContext(v8::Handle<v8::Context> context) { } PendingRequestMap& GetPendingRequestMap() { - return Singleton<SingletonData>::get()->pending_requests; + return g_singleton_data.Get().pending_requests; } RenderView* GetRenderViewForCurrentContext() { |