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

Unified Diff: Source/platform/blob/BlobRegistry.cpp

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 years, 11 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
Index: Source/platform/blob/BlobRegistry.cpp
diff --git a/Source/platform/blob/BlobRegistry.cpp b/Source/platform/blob/BlobRegistry.cpp
index cba341c796a1782f1025df1ac005699c373a9b63..a7b0678911bc64b1f251a5d2c24dd8520b7d2273 100644
--- a/Source/platform/blob/BlobRegistry.cpp
+++ b/Source/platform/blob/BlobRegistry.cpp
@@ -105,11 +105,11 @@ typedef HashMap<String, RefPtr<SecurityOrigin>> BlobURLOriginMap;
static ThreadSpecific<BlobURLOriginMap>& originMap()
{
// We want to create the BlobOriginCache exactly once because it is shared by all the threads.
- AtomicallyInitializedStatic(BlobOriginCache*, cache = new BlobOriginCache);
+ AtomicallyInitializedStaticReference(BlobOriginCache, cache, new BlobOriginCache);
(void)cache; // BlobOriginCache's constructor does the interesting work.
- AtomicallyInitializedStatic(ThreadSpecific<BlobURLOriginMap>*, map = new ThreadSpecific<BlobURLOriginMap>);
- return *map;
+ AtomicallyInitializedStaticReference(ThreadSpecific<BlobURLOriginMap>, map, new ThreadSpecific<BlobURLOriginMap>);
+ return map;
}
static void saveToOriginMap(SecurityOrigin* origin, const KURL& url)

Powered by Google App Engine
This is Rietveld 408576698