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

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

Issue 2506773002: [IndexedDB] Integrating failures and corruption with transaction (Closed)
Patch Set: Created 4 years, 1 month 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 e09458913785c85a1b5e963db68819147f48c3a4..2b5db7402e9a4836a9828ccd8d8b4236ccad4cfb 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -1339,7 +1339,7 @@ leveldb::Status IndexedDBBackingStore::CreateIDBDatabaseMetaData(
return s;
}
-bool IndexedDBBackingStore::UpdateIDBDatabaseIntVersion(
+void IndexedDBBackingStore::UpdateIDBDatabaseIntVersion(
IndexedDBBackingStore::Transaction* transaction,
int64_t row_id,
int64_t version) {
@@ -1350,7 +1350,6 @@ bool IndexedDBBackingStore::UpdateIDBDatabaseIntVersion(
transaction->transaction(),
DatabaseMetaDataKey::Encode(row_id, DatabaseMetaDataKey::USER_VERSION),
version);
- return true;
}
// If you're deleting a range that contains user keys that have blob info, this
@@ -3803,7 +3802,7 @@ bool IndexCursorImpl::LoadCurrentRow(leveldb::Status* s) {
return s->ok();
}
-bool ObjectStoreCursorOptions(
+leveldb::Status ObjectStoreCursorOptions(
LevelDBTransaction* transaction,
int64_t database_id,
int64_t object_store_id,
@@ -3832,7 +3831,7 @@ bool ObjectStoreCursorOptions(
cursor_options->low_open = range.lower_open();
}
- leveldb::Status s;
+ leveldb::Status s = leveldb::Status::OK();
if (!upper_bound) {
cursor_options->high_key =
@@ -3842,12 +3841,11 @@ bool ObjectStoreCursorOptions(
cursor_options->high_open = true; // Not included.
} else {
// We need a key that exists.
- // TODO(cmumford): Handle this error (crbug.com/363397)
if (!FindGreatestKeyLessThanOrEqual(transaction,
cursor_options->high_key,
&cursor_options->high_key,
&s))
- return false;
+ return s;
cursor_options->high_open = false;
}
} else {
@@ -3858,10 +3856,9 @@ bool ObjectStoreCursorOptions(
if (!cursor_options->forward) {
// For reverse cursors, we need a key that exists.
std::string found_high_key;
- // TODO(cmumford): Handle this error (crbug.com/363397)
if (!FindGreatestKeyLessThanOrEqual(
transaction, cursor_options->high_key, &found_high_key, &s))
- return false;
+ return s;
// If the target key should not be included, but we end up with a smaller
// key, we should include that.
@@ -3873,7 +3870,7 @@ bool ObjectStoreCursorOptions(
}
}
- return true;
+ return s;
}
bool IndexCursorOptions(
@@ -3959,15 +3956,12 @@ IndexedDBBackingStore::OpenObjectStoreCursor(
blink::WebIDBCursorDirection direction,
leveldb::Status* s) {
IDB_TRACE("IndexedDBBackingStore::OpenObjectStoreCursor");
- *s = leveldb::Status::OK();
LevelDBTransaction* leveldb_transaction = transaction->transaction();
IndexedDBBackingStore::Cursor::CursorOptions cursor_options;
- if (!ObjectStoreCursorOptions(leveldb_transaction,
- database_id,
- object_store_id,
- range,
- direction,
- &cursor_options))
+ *s = ObjectStoreCursorOptions(leveldb_transaction, database_id,
+ object_store_id, range, direction,
+ &cursor_options);
+ if (!s->ok())
return std::unique_ptr<IndexedDBBackingStore::Cursor>();
std::unique_ptr<ObjectStoreCursorImpl> cursor(
base::MakeUnique<ObjectStoreCursorImpl>(this, transaction, database_id,
@@ -3987,15 +3981,12 @@ IndexedDBBackingStore::OpenObjectStoreKeyCursor(
blink::WebIDBCursorDirection direction,
leveldb::Status* s) {
IDB_TRACE("IndexedDBBackingStore::OpenObjectStoreKeyCursor");
- *s = leveldb::Status::OK();
LevelDBTransaction* leveldb_transaction = transaction->transaction();
IndexedDBBackingStore::Cursor::CursorOptions cursor_options;
- if (!ObjectStoreCursorOptions(leveldb_transaction,
- database_id,
- object_store_id,
- range,
- direction,
- &cursor_options))
+ *s = ObjectStoreCursorOptions(leveldb_transaction, database_id,
+ object_store_id, range, direction,
+ &cursor_options);
+ if (!s->ok())
return std::unique_ptr<IndexedDBBackingStore::Cursor>();
std::unique_ptr<ObjectStoreKeyCursorImpl> cursor(
base::MakeUnique<ObjectStoreKeyCursorImpl>(this, transaction, database_id,

Powered by Google App Engine
This is Rietveld 408576698