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

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

Issue 17033004: Tell IDB frontend about data loss (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debug 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_backing_store.cc
diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc
index e3b6a43369b235807614276dd7c349a372e01ed1..ecf43be64490aca34ddb411a85e1a7cc17b595d8 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -421,19 +421,26 @@ enum IndexedDBLevelDBBackingStoreOpenResult {
scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
const string16& database_identifier,
const base::FilePath& path_base,
- const string16& file_identifier) {
+ const string16& file_identifier,
+ bool* data_loss) {
+ *data_loss = false;
DefaultLevelDBFactory leveldb_factory;
- return IndexedDBBackingStore::Open(
- database_identifier, path_base, file_identifier, &leveldb_factory);
+ return IndexedDBBackingStore::Open(database_identifier,
+ path_base,
+ file_identifier,
+ data_loss,
+ &leveldb_factory);
}
scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
const string16& database_identifier,
const base::FilePath& path_base,
const string16& file_identifier,
+ bool* data_loss,
LevelDBFactory* leveldb_factory) {
IDB_TRACE("IndexedDBBackingStore::open");
DCHECK(!path_base.empty());
+ *data_loss = false;
scoped_ptr<LevelDBComparator> comparator(new Comparator());
scoped_ptr<LevelDBDatabase> db;
@@ -549,6 +556,7 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
return scoped_refptr<IndexedDBBackingStore>();
} else {
LOG(ERROR) << "IndexedDB backing store open failed, attempting cleanup";
+ *data_loss = true;
bool success = leveldb_factory->DestroyLevelDB(file_path);
if (!success) {
LOG(ERROR) << "IndexedDB backing store cleanup failed";

Powered by Google App Engine
This is Rietveld 408576698