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

Unified Diff: Source/core/timing/MemoryInfo.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/core/timing/MemoryInfo.cpp
diff --git a/Source/core/timing/MemoryInfo.cpp b/Source/core/timing/MemoryInfo.cpp
index 26e957b51b77fa170ab78d3388b267b2623ff28c..d5466ee33fa0f79995d904e942063074d994c33c 100644
--- a/Source/core/timing/MemoryInfo.cpp
+++ b/Source/core/timing/MemoryInfo.cpp
@@ -58,8 +58,8 @@ public:
static HeapSizeCache& forCurrentThread()
{
- AtomicallyInitializedStatic(ThreadSpecific<HeapSizeCache>*, heapSizeCache = new ThreadSpecific<HeapSizeCache>);
- return **heapSizeCache;
+ AtomicallyInitializedStaticReference(ThreadSpecific<HeapSizeCache>, heapSizeCache, new ThreadSpecific<HeapSizeCache>);
+ return *heapSizeCache;
}
private:

Powered by Google App Engine
This is Rietveld 408576698