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

Unified Diff: Source/wtf/CryptographicallyRandomNumber.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/wtf/CryptographicallyRandomNumber.cpp
diff --git a/Source/wtf/CryptographicallyRandomNumber.cpp b/Source/wtf/CryptographicallyRandomNumber.cpp
index 285a5c95a9e31d312d5802416195d0875d884a0c..a25363d5207d39e24074184f03ef5698d95bdf67 100644
--- a/Source/wtf/CryptographicallyRandomNumber.cpp
+++ b/Source/wtf/CryptographicallyRandomNumber.cpp
@@ -165,8 +165,8 @@ void ARC4RandomNumberGenerator::randomValues(void* buffer, size_t length)
ARC4RandomNumberGenerator& sharedRandomNumberGenerator()
{
- AtomicallyInitializedStatic(ARC4RandomNumberGenerator*, randomNumberGenerator = new ARC4RandomNumberGenerator);
- return *randomNumberGenerator;
+ AtomicallyInitializedStaticReference(ARC4RandomNumberGenerator, randomNumberGenerator, new ARC4RandomNumberGenerator);
+ return randomNumberGenerator;
}
}
« no previous file with comments | « Source/wtf/Atomics.h ('k') | Source/wtf/HashTable.cpp » ('j') | Source/wtf/Threading.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698