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

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

Issue 26045002: Don't reset the database when there was an I/O error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change to IsIOError Created 7 years, 2 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
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b6da42aebd8df604c5d4fa747f03e23f43f1504f..5733b6e1bb40fd957be544cf1a0b7e4125a09b7f 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -396,48 +396,12 @@ enum IndexedDBBackingStoreOpenResult {
INDEXED_DB_BACKING_STORE_OPEN_FAILED_UNKNOWN_ERR,
INDEXED_DB_BACKING_STORE_OPEN_MEMORY_FAILED,
INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII,
- INDEXED_DB_BACKING_STORE_OPEN_DISK_FULL,
+ INDEXED_DB_BACKING_STORE_OPEN_DISK_FULL_DEPRECATED,
INDEXED_DB_BACKING_STORE_OPEN_ORIGIN_TOO_LONG,
INDEXED_DB_BACKING_STORE_OPEN_NO_RECOVERY,
INDEXED_DB_BACKING_STORE_OPEN_MAX,
};
-// TODO(dgrogan): Move to leveldb_env.
-bool RecoveryCouldBeFruitful(leveldb::Status status) {
- leveldb_env::MethodID method;
- int error = -1;
- leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError(
- status.ToString().c_str(), &method, &error);
- switch (result) {
- case leveldb_env::NONE:
- return true;
- case leveldb_env::METHOD_AND_PFE: {
- base::PlatformFileError pfe = static_cast<base::PlatformFileError>(error);
- switch (pfe) {
- case base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED:
- case base::PLATFORM_FILE_ERROR_NO_MEMORY:
- case base::PLATFORM_FILE_ERROR_NO_SPACE:
- return false;
- default:
- return true;
- }
- }
- case leveldb_env::METHOD_AND_ERRNO: {
- switch (error) {
- case EMFILE:
- case ENOMEM:
- case ENOSPC:
- return false;
- default:
- return true;
- }
- }
- default:
- return true;
- }
- return true;
-}
-
scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
const std::string& origin_identifier,
const base::FilePath& path_base,
@@ -551,15 +515,11 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
if (db) {
HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_SUCCESS);
- } else if (!RecoveryCouldBeFruitful(status)) {
+ } else if (leveldb_env::IsIOError(status)) {
LOG(ERROR) << "Unable to open backing store, not trying to recover - "
<< status.ToString();
HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_NO_RECOVERY);
return scoped_refptr<IndexedDBBackingStore>();
- } else if (*is_disk_full) {
- LOG(ERROR) << "Unable to open backing store - disk is full.";
- HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_DISK_FULL);
- return scoped_refptr<IndexedDBBackingStore>();
} else {
LOG(ERROR) << "IndexedDB backing store open failed, attempting cleanup";
*data_loss = WebKit::WebIDBCallbacks::DataLossTotal;
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698