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

Unified Diff: content/browser/indexed_db/indexed_db_factory_impl.cc

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: content/browser/indexed_db/indexed_db_factory_impl.cc
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.cc b/content/browser/indexed_db/indexed_db_factory_impl.cc
index d4d55119bc988e909aaaca5ee4ff31154eefa88f..49cf4cfb62a4dc817f71b7c46c3c210ad40aebd5 100644
--- a/content/browser/indexed_db/indexed_db_factory_impl.cc
+++ b/content/browser/indexed_db/indexed_db_factory_impl.cc
@@ -15,8 +15,11 @@
#include "content/browser/indexed_db/indexed_db_backing_store.h"
#include "content/browser/indexed_db/indexed_db_context_impl.h"
#include "content/browser/indexed_db/indexed_db_database_error.h"
+#include "content/browser/indexed_db/indexed_db_pending_connection.h"
+#include "content/browser/indexed_db/indexed_db_pending_delete.h"
#include "content/browser/indexed_db/indexed_db_tracing.h"
#include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
+#include "net/url_request/url_request_context_getter.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h"
#include "third_party/leveldatabase/env_chromium.h"
@@ -169,7 +172,6 @@ void IndexedDBFactoryImpl::ReportOutstandingBlobs(const Origin& origin,
}
void IndexedDBFactoryImpl::GetDatabaseNames(
- scoped_refptr<IndexedDBCallbacks> callbacks,
const Origin& origin,
const base::FilePath& data_directory,
scoped_refptr<net::URLRequestContextGetter> request_context_getter) {
@@ -183,10 +185,12 @@ void IndexedDBFactoryImpl::GetDatabaseNames(
OpenBackingStore(origin, data_directory, request_context_getter,
&data_loss_info, &disk_full, &s);
if (!backing_store.get()) {
+#ifdef CJM_NEED_CALLBACK
callbacks->OnError(
IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
"Internal error opening backing store for "
"indexedDB.webkitGetDatabaseNames."));
+#endif
return;
}
@@ -196,13 +200,17 @@ void IndexedDBFactoryImpl::GetDatabaseNames(
IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
"Internal error opening backing store for "
"indexedDB.webkitGetDatabaseNames.");
+#ifdef CJM_NEED_CALLBACK
callbacks->OnError(error);
+#endif
backing_store = NULL;
if (s.IsCorruption())
HandleBackingStoreCorruption(origin, error);
return;
}
+#ifdef CJM_NEED_CALLBACK
callbacks->OnSuccess(names);
+#endif
backing_store = NULL;
ReleaseBackingStore(origin, false /* immediate */);
}
@@ -210,7 +218,7 @@ void IndexedDBFactoryImpl::GetDatabaseNames(
void IndexedDBFactoryImpl::DeleteDatabase(
const base::string16& name,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
- scoped_refptr<IndexedDBCallbacks> callbacks,
+ std::unique_ptr<IndexedDBPendingDelete> pending_delete,
const Origin& origin,
const base::FilePath& data_directory) {
IDB_TRACE("IndexedDBFactoryImpl::DeleteDatabase");
@@ -219,7 +227,7 @@ void IndexedDBFactoryImpl::DeleteDatabase(
if (it != database_map_.end()) {
// If there are any connections to the database, directly delete the
// database.
- it->second->DeleteDatabase(callbacks);
+ it->second->DeleteDatabase(std::move(pending_delete));
return;
}
@@ -235,7 +243,7 @@ void IndexedDBFactoryImpl::DeleteDatabase(
ASCIIToUTF16(
"Internal error opening backing store "
"for indexedDB.deleteDatabase."));
- callbacks->OnError(error);
+ pending_delete->OnError(error);
if (s.IsCorruption()) {
HandleBackingStoreCorruption(origin, error);
}
@@ -248,15 +256,17 @@ void IndexedDBFactoryImpl::DeleteDatabase(
IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
"Internal error opening backing store for "
"indexedDB.deleteDatabase.");
- callbacks->OnError(error);
+ pending_delete->OnError(error);
backing_store = NULL;
if (s.IsCorruption())
HandleBackingStoreCorruption(origin, error);
return;
}
if (!base::ContainsValue(names, name)) {
+#ifdef CJM_NEED_CALLBACK
const int64_t version = 0;
- callbacks->OnSuccess(version);
+ pending_delete->OnSuccess(version);
+#endif
backing_store = NULL;
ReleaseBackingStore(origin, false /* immediate */);
return;
@@ -270,7 +280,7 @@ void IndexedDBFactoryImpl::DeleteDatabase(
ASCIIToUTF16(
"Internal error creating database backend for "
"indexedDB.deleteDatabase."));
- callbacks->OnError(error);
+ pending_delete->OnError(error);
if (s.IsCorruption()) {
backing_store = NULL;
HandleBackingStoreCorruption(origin, error);
@@ -280,7 +290,7 @@ void IndexedDBFactoryImpl::DeleteDatabase(
database_map_[unique_identifier] = database.get();
origin_dbs_.insert(std::make_pair(origin, database.get()));
- database->DeleteDatabase(callbacks);
+ database->DeleteDatabase(std::move(pending_delete));
RemoveDatabaseFromMaps(unique_identifier);
database = NULL;
backing_store = NULL;
@@ -419,7 +429,7 @@ void IndexedDBFactoryImpl::Open(
&data_loss_info, &disk_full, &s);
if (!backing_store.get()) {
if (disk_full) {
- connection->callbacks->OnError(IndexedDBDatabaseError(
+ connection->OnError(IndexedDBDatabaseError(
blink::WebIDBDatabaseExceptionQuotaError,
ASCIIToUTF16("Encountered full disk while opening "
"backing store for indexedDB.open.")));
@@ -429,7 +439,7 @@ void IndexedDBFactoryImpl::Open(
ASCIIToUTF16(
"Internal error opening backing store"
" for indexedDB.open."));
- connection->callbacks->OnError(error);
+ connection->OnError(error);
if (s.IsCorruption()) {
HandleBackingStoreCorruption(origin, error);
}
@@ -445,7 +455,7 @@ void IndexedDBFactoryImpl::Open(
"Internal error creating "
"database backend for "
"indexedDB.open."));
- connection->callbacks->OnError(error);
+ connection->OnError(error);
if (s.IsCorruption()) {
backing_store = NULL; // Closes the LevelDB so that it can be deleted
HandleBackingStoreCorruption(origin, error);
@@ -456,7 +466,7 @@ void IndexedDBFactoryImpl::Open(
database = it->second;
}
- connection->data_loss_info = data_loss_info;
+ connection->SetDataLossInfo(data_loss_info);
database->OpenConnection(std::move(connection));
@@ -482,4 +492,8 @@ size_t IndexedDBFactoryImpl::GetConnectionCount(const Origin& origin) const {
return count;
}
+IndexedDBContext* IndexedDBFactoryImpl::context() const {
+ return context_;
+}
+
} // namespace content
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory_impl.h ('k') | content/browser/indexed_db/indexed_db_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698