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

Unified Diff: Source/modules/webdatabase/DatabaseManager.cpp

Issue 308593004: Fix a race in DatabaseManager::manager. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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: Source/modules/webdatabase/DatabaseManager.cpp
diff --git a/Source/modules/webdatabase/DatabaseManager.cpp b/Source/modules/webdatabase/DatabaseManager.cpp
index a6bfc1a76ac64067876cf0fc74d1a7dcb415dfdf..78042ec8595756bc7cbe6fe334e32294c45a7b5e 100644
--- a/Source/modules/webdatabase/DatabaseManager.cpp
+++ b/Source/modules/webdatabase/DatabaseManager.cpp
@@ -49,12 +49,7 @@ namespace WebCore {
DatabaseManager& DatabaseManager::manager()
{
- static DatabaseManager* dbManager = 0;
- // FIXME: The following is vulnerable to a race between threads. Need to
- // implement a thread safe on-first-use static initializer.
- if (!dbManager)
- dbManager = new DatabaseManager();
-
+ AtomicallyInitializedStatic(DatabaseManager*, dbManager = new DatabaseManager);
eseidel 2014/05/29 07:03:37 I didn't know this existed, crazy. https://code.g
return *dbManager;
}
« 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