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

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

Issue 17033004: Tell IDB frontend about data loss (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use IPC_ENUM_TRAITS_MAX_VALUE Created 7 years, 6 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.cc
diff --git a/content/browser/indexed_db/indexed_db_factory.cc b/content/browser/indexed_db/indexed_db_factory.cc
index 374e96c7d53f2cdb45b26c0448956b760029e8f1..02fa53d1fdab8417961e7911a9e4a1886e708ce3 100644
--- a/content/browser/indexed_db/indexed_db_factory.cc
+++ b/content/browser/indexed_db/indexed_db_factory.cc
@@ -55,8 +55,10 @@ void IndexedDBFactory::GetDatabaseNames(
const string16& database_identifier,
const base::FilePath& data_directory) {
IDB_TRACE("IndexedDBFactory::get_database_names");
+ // TODO(dgrogan): Plumb data_loss back to script eventually?
+ WebKit::WebIDBCallbacks::DataLoss data_loss;
scoped_refptr<IndexedDBBackingStore> backing_store =
- OpenBackingStore(database_identifier, data_directory);
+ OpenBackingStore(database_identifier, data_directory, &data_loss);
if (!backing_store.get()) {
callbacks->OnError(
IndexedDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError,
@@ -87,8 +89,11 @@ void IndexedDBFactory::DeleteDatabase(
}
// TODO(jsbell): Everything from now on should be done on another thread.
+
+ // TODO(dgrogan): Plumb data_loss back to script eventually?
+ WebKit::WebIDBCallbacks::DataLoss data_loss;
scoped_refptr<IndexedDBBackingStore> backing_store =
- OpenBackingStore(database_identifier, data_directory);
+ OpenBackingStore(database_identifier, data_directory, &data_loss);
if (!backing_store.get()) {
callbacks->OnError(IndexedDBDatabaseError(
WebKit::WebIDBDatabaseExceptionUnknownError,
@@ -114,7 +119,8 @@ void IndexedDBFactory::DeleteDatabase(
scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore(
const string16& database_identifier,
- const base::FilePath& data_directory) {
+ const base::FilePath& data_directory,
+ WebKit::WebIDBCallbacks::DataLoss* data_loss) {
const string16 file_identifier = ComputeFileIdentifier(database_identifier);
const bool open_in_memory = data_directory.empty();
@@ -128,7 +134,7 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore(
backing_store = IndexedDBBackingStore::OpenInMemory(file_identifier);
} else {
backing_store = IndexedDBBackingStore::Open(
- database_identifier, data_directory, file_identifier);
+ database_identifier, data_directory, file_identifier, data_loss);
}
if (backing_store.get()) {
@@ -163,9 +169,11 @@ void IndexedDBFactory::Open(
scoped_refptr<IndexedDBDatabase> database_backend;
IndexedDBDatabaseMap::iterator it =
database_backend_map_.find(unique_identifier);
+ WebKit::WebIDBCallbacks::DataLoss data_loss =
+ WebKit::WebIDBCallbacks::DataLossNone;
if (it == database_backend_map_.end()) {
scoped_refptr<IndexedDBBackingStore> backing_store =
- OpenBackingStore(database_identifier, data_directory);
+ OpenBackingStore(database_identifier, data_directory, &data_loss);
if (!backing_store.get()) {
callbacks->OnError(IndexedDBDatabaseError(
WebKit::WebIDBDatabaseExceptionUnknownError,
@@ -190,7 +198,7 @@ void IndexedDBFactory::Open(
}
database_backend->OpenConnection(
- callbacks, database_callbacks, transaction_id, version);
+ callbacks, database_callbacks, transaction_id, version, data_loss);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698