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

Unified Diff: Source/modules/indexeddb/IDBTransaction.cpp

Issue 426063010: IndexedDB: Fixed threading bugs with use of AtomicStrings. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switched to proper code-generated static strings like Core creates them. Created 6 years, 4 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/modules/indexeddb/IDBTransaction.cpp
diff --git a/Source/modules/indexeddb/IDBTransaction.cpp b/Source/modules/indexeddb/IDBTransaction.cpp
index 3a2453fee13820d0cb838c76cf1d38a707ddf00b..654fb777a8218642db30d48d5645950c6ca8e09d 100644
--- a/Source/modules/indexeddb/IDBTransaction.cpp
+++ b/Source/modules/indexeddb/IDBTransaction.cpp
@@ -31,6 +31,7 @@
#include "core/dom/ExecutionContext.h"
#include "core/events/EventQueue.h"
#include "core/inspector/ScriptCallStack.h"
+#include "modules/IndexedDBNames.h"
#include "modules/indexeddb/IDBDatabase.h"
#include "modules/indexeddb/IDBEventDispatcher.h"
#include "modules/indexeddb/IDBIndex.h"
@@ -58,24 +59,6 @@ IDBTransaction* IDBTransaction::create(ExecutionContext* context, int64_t id, ID
return transaction;
}
-const AtomicString& IDBTransaction::modeReadOnly()
-{
- DEFINE_STATIC_LOCAL(AtomicString, readonly, ("readonly", AtomicString::ConstructFromLiteral));
- return readonly;
-}
-
-const AtomicString& IDBTransaction::modeReadWrite()
-{
- DEFINE_STATIC_LOCAL(AtomicString, readwrite, ("readwrite", AtomicString::ConstructFromLiteral));
- return readwrite;
-}
-
-const AtomicString& IDBTransaction::modeVersionChange()
-{
- DEFINE_STATIC_LOCAL(AtomicString, versionchange, ("versionchange", AtomicString::ConstructFromLiteral));
- return versionchange;
-}
-
IDBTransaction::IDBTransaction(ExecutionContext* context, int64_t id, const Vector<String>& objectStoreNames, blink::WebIDBTransactionMode mode, IDBDatabase* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata)
: ActiveDOMObject(context)
, m_id(id)
@@ -117,11 +100,6 @@ void IDBTransaction::trace(Visitor* visitor)
EventTargetWithInlineData::trace(visitor);
}
-const String& IDBTransaction::mode() const
-{
- return modeToString(m_mode);
-}
-
void IDBTransaction::setError(PassRefPtrWillBeRawPtr<DOMError> error)
{
ASSERT(m_state != Finished);
@@ -301,33 +279,30 @@ bool IDBTransaction::hasPendingActivity() const
blink::WebIDBTransactionMode IDBTransaction::stringToMode(const String& modeString, ExceptionState& exceptionState)
{
- if (modeString == IDBTransaction::modeReadOnly())
+ if (modeString == IndexedDBNames::readonly)
return blink::WebIDBTransactionModeReadOnly;
- if (modeString == IDBTransaction::modeReadWrite())
+ if (modeString == IndexedDBNames::readwrite)
return blink::WebIDBTransactionModeReadWrite;
exceptionState.throwTypeError("The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'.");
return blink::WebIDBTransactionModeReadOnly;
}
-const AtomicString& IDBTransaction::modeToString(blink::WebIDBTransactionMode mode)
+const String& IDBTransaction::mode() const
{
- switch (mode) {
+ switch (m_mode) {
case blink::WebIDBTransactionModeReadOnly:
- return IDBTransaction::modeReadOnly();
- break;
+ return IndexedDBNames::readonly;
case blink::WebIDBTransactionModeReadWrite:
- return IDBTransaction::modeReadWrite();
- break;
+ return IndexedDBNames::readwrite;
case blink::WebIDBTransactionModeVersionChange:
- return IDBTransaction::modeVersionChange();
- break;
+ return IndexedDBNames::versionchange;
}
ASSERT_NOT_REACHED();
- return IDBTransaction::modeReadOnly();
+ return IndexedDBNames::readonly;
}
const AtomicString& IDBTransaction::interfaceName() const

Powered by Google App Engine
This is Rietveld 408576698