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

Unified Diff: third_party/WebKit/Source/modules/webdatabase/Database.cpp

Issue 1694893002: Avoid data race on Database::m_opened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid casts Created 4 years, 10 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 | « third_party/WebKit/Source/modules/webdatabase/Database.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webdatabase/Database.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
index 49172e398407040128481fd2e1554d7e8fd9f28a..7074cbd62480c5fa4b9571728eaf71b3486581fb 100644
--- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -53,6 +53,7 @@
#include "platform/weborigin/DatabaseIdentifier.h"
#include "public/platform/Platform.h"
#include "public/platform/WebDatabaseObserver.h"
+#include "wtf/Atomics.h"
// Registering "opened" databases with the DatabaseTracker
// =======================================================
@@ -208,7 +209,7 @@ Database::Database(DatabaseContext* databaseContext, const String& name, const S
, m_displayName(displayName.isolatedCopy())
, m_estimatedSize(estimatedSize)
, m_guid(0)
- , m_opened(false)
+ , m_opened(0)
, m_new(false)
, m_transactionInProgress(false)
, m_isTransactionQueueEnabled(true)
@@ -369,8 +370,8 @@ void Database::closeDatabase()
if (!m_opened)
return;
+ releaseStore(&m_opened, 0);
m_sqliteDatabase.close();
- m_opened = false;
// See comment at the top this file regarding calling removeOpenDatabase().
DatabaseTracker::tracker().removeOpenDatabase(this);
{
@@ -530,7 +531,7 @@ bool Database::performOpenAndVerify(bool shouldSetVersionInNewDatabase, Database
// See comment at the top this file regarding calling addOpenDatabase().
DatabaseTracker::tracker().addOpenDatabase(this);
- m_opened = true;
+ m_opened = 1;
// Declare success:
error = DatabaseError::None; // Clear the presumed error from above.
@@ -901,4 +902,9 @@ SecurityOrigin* Database::securityOrigin() const
return 0;
}
+bool Database::opened()
+{
+ return static_cast<bool>(acquireLoad(&m_opened));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/webdatabase/Database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698