Index: third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp |
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp |
index fa8eda53199a792a5f9e622d354908b9379f16d1..dd1a944f6846c799fccdb1848dff395cdbddd707 100644 |
--- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp |
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp |
@@ -34,6 +34,7 @@ |
#include "core/dom/ExecutionContext.h" |
#include "core/events/EventQueue.h" |
#include "modules/indexeddb/IDBAny.h" |
+#include "modules/indexeddb/IDBDatabaseProxy.h" |
#include "modules/indexeddb/IDBEventDispatcher.h" |
#include "modules/indexeddb/IDBIndex.h" |
#include "modules/indexeddb/IDBKeyPath.h" |
@@ -47,7 +48,8 @@ |
#include <limits> |
#include <memory> |
-using blink::WebIDBDatabase; |
+using blink::IDBDatabaseProxy; |
+using indexed_db::mojom::blink::TransactionMode; |
namespace blink { |
@@ -67,14 +69,14 @@ const char IDBDatabase::transactionFinishedErrorMessage[] = "The transaction has |
const char IDBDatabase::transactionReadOnlyErrorMessage[] = "The transaction is read-only."; |
const char IDBDatabase::databaseClosedErrorMessage[] = "The database connection is closed."; |
-IDBDatabase* IDBDatabase::create(ExecutionContext* context, std::unique_ptr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks) |
+IDBDatabase* IDBDatabase::create(ExecutionContext* context, std::unique_ptr<IDBDatabaseProxy> database, IDBDatabaseCallbacks* callbacks) |
{ |
IDBDatabase* idbDatabase = new IDBDatabase(context, std::move(database), callbacks); |
idbDatabase->suspendIfNeeded(); |
return idbDatabase; |
} |
-IDBDatabase::IDBDatabase(ExecutionContext* context, std::unique_ptr<WebIDBDatabase> backend, IDBDatabaseCallbacks* callbacks) |
+IDBDatabase::IDBDatabase(ExecutionContext* context, std::unique_ptr<IDBDatabaseProxy> backend, IDBDatabaseCallbacks* callbacks) |
: ActiveScriptWrappable(this) |
, ActiveDOMObject(context) |
, m_backend(std::move(backend)) |
@@ -86,7 +88,7 @@ IDBDatabase::IDBDatabase(ExecutionContext* context, std::unique_ptr<WebIDBDataba |
IDBDatabase::~IDBDatabase() |
{ |
if (!m_closePending && m_backend) |
- m_backend->close(); |
+ m_backend->Close(); |
} |
DEFINE_TRACE(IDBDatabase) |
@@ -209,9 +211,9 @@ IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP |
} |
int64_t objectStoreId = m_metadata.maxObjectStoreId + 1; |
- m_backend->createObjectStore(m_versionChangeTransaction->id(), objectStoreId, name, keyPath, autoIncrement); |
+ m_backend->CreateObjectStore(m_versionChangeTransaction->id(), objectStoreId, name, keyPath, autoIncrement); |
- IDBObjectStoreMetadata metadata(name, objectStoreId, keyPath, autoIncrement, WebIDBDatabase::minimumIndexId); |
+ IDBObjectStoreMetadata metadata(name, objectStoreId, keyPath, autoIncrement, indexed_db::mojom::blink::Database::minimumIndexId); |
IDBObjectStore* objectStore = IDBObjectStore::create(metadata, m_versionChangeTransaction.get()); |
m_metadata.objectStores.set(metadata.id, metadata); |
++m_metadata.maxObjectStoreId; |
@@ -248,7 +250,7 @@ void IDBDatabase::deleteObjectStore(const String& name, ExceptionState& exceptio |
return; |
} |
- m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId); |
+ m_backend->DeleteObjectStore(m_versionChangeTransaction->id(), objectStoreId); |
m_versionChangeTransaction->objectStoreDeleted(name); |
m_metadata.objectStores.remove(objectStoreId); |
} |
@@ -277,8 +279,8 @@ IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const StringO |
return nullptr; |
} |
- WebIDBTransactionMode mode = IDBTransaction::stringToMode(modeString); |
- if (mode != WebIDBTransactionModeReadOnly && mode != WebIDBTransactionModeReadWrite) { |
+ TransactionMode mode = IDBTransaction::stringToMode(modeString); |
+ if (mode != TransactionMode::ReadOnly && mode != TransactionMode::ReadWrite) { |
exceptionState.throwTypeError("The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'."); |
return nullptr; |
} |
@@ -312,7 +314,7 @@ IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const StringO |
} |
int64_t transactionId = nextTransactionId(); |
- m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::create(m_databaseCallbacks).release(), objectStoreIds, mode); |
+ m_backend->CreateTransaction(transactionId, std::move(objectStoreIds), mode); |
return IDBTransaction::create(scriptState, transactionId, scope, mode, this); |
} |
@@ -343,7 +345,7 @@ void IDBDatabase::closeConnection() |
ASSERT(m_transactions.isEmpty()); |
if (m_backend) { |
- m_backend->close(); |
+ m_backend->Close(); |
m_backend.reset(); |
} |
@@ -371,7 +373,7 @@ void IDBDatabase::onVersionChange(int64_t oldVersion, int64_t newVersion) |
// If we're pending, that means there's a busy transaction. We won't |
// fire 'versionchange' but since we're not closing immediately the |
// back-end should still send out 'blocked'. |
- m_backend->versionChangeIgnored(); |
+ m_backend->VersionChangeIgnored(); |
return; |
} |
@@ -402,7 +404,7 @@ DispatchEventResult IDBDatabase::dispatchEventInternal(Event* event) |
DispatchEventResult dispatchResult = EventTarget::dispatchEventInternal(event); |
if (event->type() == EventTypeNames::versionchange && !m_closePending && m_backend) |
- m_backend->versionChangeIgnored(); |
+ m_backend->VersionChangeIgnored(); |
return dispatchResult; |
} |
@@ -432,7 +434,7 @@ void IDBDatabase::stop() |
// normal close() since that may wait on transactions which require a |
// round trip to the back-end to abort. |
if (m_backend) { |
- m_backend->close(); |
+ m_backend->Close(); |
m_backend.reset(); |
} |
} |