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

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

Issue 16409006: Don't delete leveldb directory if disk was full. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move to else if block 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 ccd6bf827fb43b8a2f4dd27f12064371f2286a19..329127ed5a5c8ee3a074d3f7e7e404bb9a27c153 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -365,8 +365,8 @@ class DefaultLevelDBFactory : public LevelDBFactory {
public:
virtual scoped_ptr<LevelDBDatabase> OpenLevelDB(
const base::FilePath& file_name,
- const LevelDBComparator* comparator) OVERRIDE {
- return LevelDBDatabase::Open(file_name, comparator);
+ const LevelDBComparator* comparator, bool* is_disk_full) OVERRIDE {
+ return LevelDBDatabase::Open(file_name, comparator, is_disk_full);
}
virtual bool DestroyLevelDB(const base::FilePath& file_name) OVERRIDE {
return LevelDBDatabase::Destroy(file_name);
@@ -499,7 +499,8 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
base::FilePath file_path = path_base.Append(identifier_path);
- db = leveldb_factory->OpenLevelDB(file_path, comparator.get());
+ bool is_disk_full = false;
+ db = leveldb_factory->OpenLevelDB(file_path, comparator.get(), &is_disk_full);
if (db) {
bool known = false;
@@ -536,6 +537,16 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
INDEXED_DB_LEVEL_DB_BACKING_STORE_OPEN_MAX + 1,
base::HistogramBase::kUmaTargetedHistogramFlag)
->Add(INDEXED_DB_LEVEL_DB_BACKING_STORE_OPEN_SUCCESS);
+ } else if (is_disk_full) {
+ LOG(ERROR) << "Unable to open backing store - disk is full.";
+ base::Histogram::FactoryGet(
+ "WebCore.IndexedDB.BackingStore.OpenStatus",
+ 1,
+ INDEXED_DB_LEVEL_DB_BACKING_STORE_OPEN_MAX,
+ INDEXED_DB_LEVEL_DB_BACKING_STORE_OPEN_MAX + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag)
+ ->Add(INDEXED_DB_LEVEL_DB_BACKING_STORE_OPEN_DISK_FULL);
+ return scoped_refptr<IndexedDBBackingStore>();
} else {
LOG(ERROR) << "IndexedDB backing store open failed, attempting cleanup";
bool success = leveldb_factory->DestroyLevelDB(file_path);

Powered by Google App Engine
This is Rietveld 408576698