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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 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: third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
index 737435363e2c49374c8f701e580bee84ac3ef43b..f485e1133654a1fb549e5569abb6de966ec9419f 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
@@ -34,18 +34,15 @@
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "modules/indexeddb/IDBDatabase.h"
-#include "modules/indexeddb/IDBDatabaseCallbacks.h"
+#include "modules/indexeddb/IDBDatabaseObserverImpl.h"
#include "modules/indexeddb/IDBKey.h"
#include "modules/indexeddb/IDBTracing.h"
#include "modules/indexeddb/IndexedDBClient.h"
-#include "modules/indexeddb/WebIDBCallbacksImpl.h"
-#include "modules/indexeddb/WebIDBDatabaseCallbacksImpl.h"
#include "platform/Histogram.h"
#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/InterfaceProvider.h"
#include "public/platform/Platform.h"
#include "public/platform/WebSecurityOrigin.h"
-#include "public/platform/modules/indexeddb/WebIDBFactory.h"
-#include <memory>
namespace blink {
@@ -53,6 +50,15 @@ static const char permissionDeniedErrorMessage[] = "The user denied permission t
IDBFactory::IDBFactory()
{
+ // TODO(cmumford): I'm sure this can fail.
+ // TODO(cmumford): Should we connect (lazily) once and share the Mojo
+ // factory between all IDBFactory's?
+ Platform::current()->interfaceProvider()->getInterface(mojo::GetProxy(&m_proxy));
+ DCHECK(m_proxy);
+}
+
+IDBFactory::~IDBFactory()
+{
}
static bool isContextValid(ExecutionContext* context)
@@ -82,7 +88,7 @@ IDBRequest* IDBFactory::getDatabaseNames(ScriptState* scriptState, ExceptionStat
return request;
}
- Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksImpl::create(request).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin()));
+ m_proxy->GetDatabaseNames(scriptState->getExecutionContext()->getSecurityOrigin());
return request;
}
@@ -107,16 +113,19 @@ IDBOpenDBRequest* IDBFactory::openInternal(ScriptState* scriptState, const Strin
return nullptr;
}
- IDBDatabaseCallbacks* databaseCallbacks = IDBDatabaseCallbacks::create();
int64_t transactionId = IDBDatabase::nextTransactionId();
- IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, databaseCallbacks, transactionId, version);
+ indexed_db::mojom::blink::OpenRequestObserverPtr openRequestObserver;
+ IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, transactionId, version, GetProxy(&openRequestObserver));
+ indexed_db::mojom::blink::DatabaseObserverPtr databaseObserver = IDBDatabaseObserverImpl::Create(request);
if (!IndexedDBClient::from(scriptState->getExecutionContext())->allowIndexedDB(scriptState->getExecutionContext(), name)) {
request->onError(DOMException::create(UnknownError, permissionDeniedErrorMessage));
return request;
}
- Platform::current()->idbFactory()->open(name, version, transactionId, WebIDBCallbacksImpl::create(request).release(), WebIDBDatabaseCallbacksImpl::create(databaseCallbacks).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin()));
+ indexed_db::mojom::blink::DatabaseFactory::OpenCallback openCallback = convertToBaseCallback(WTF::bind(&IDBOpenDBRequest::onOpenResult, wrapWeakPersistent(request)));
+
+ m_proxy->Open(name, version, transactionId, scriptState->getExecutionContext()->getSecurityOrigin(), std::move(openRequestObserver), std::move(databaseObserver), openCallback);
return request;
}
@@ -137,14 +146,15 @@ IDBOpenDBRequest* IDBFactory::deleteDatabase(ScriptState* scriptState, const Str
return nullptr;
}
- IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, nullptr, 0, IDBDatabaseMetadata::DefaultVersion);
+ indexed_db::mojom::blink::OpenRequestObserverPtr openRequestObserver;
+ IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, 0, IDBDatabaseMetadata::DefaultVersion, GetProxy(&openRequestObserver));
if (!IndexedDBClient::from(scriptState->getExecutionContext())->allowIndexedDB(scriptState->getExecutionContext(), name)) {
request->onError(DOMException::create(UnknownError, permissionDeniedErrorMessage));
return request;
}
- Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl::create(request).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin()));
+ m_proxy->DeleteDatabase(name, scriptState->getExecutionContext()->getSecurityOrigin());
return request;
}
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBFactory.h ('k') | third_party/WebKit/Source/modules/indexeddb/IDBIndex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698