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

Unified Diff: content/browser/indexed_db/leveldb/leveldb_transaction.cc

Issue 1996443003: Return number of values deleted by IDBObjectStore.delete(range) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete Range Created 4 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/leveldb/leveldb_transaction.cc
diff --git a/content/browser/indexed_db/leveldb/leveldb_transaction.cc b/content/browser/indexed_db/leveldb/leveldb_transaction.cc
index 2abd7e6033d7cd457d591bb9bc1b8f623e308648..a42f3c3da4ff5cfeade3b9c3905a5c043a6575fd 100644
--- a/content/browser/indexed_db/leveldb/leveldb_transaction.cc
+++ b/content/browser/indexed_db/leveldb/leveldb_transaction.cc
@@ -36,7 +36,7 @@ void LevelDBTransaction::Clear() {
LevelDBTransaction::~LevelDBTransaction() { Clear(); }
-void LevelDBTransaction::Set(const StringPiece& key,
+bool LevelDBTransaction::Set(const StringPiece& key,
std::string* value,
bool deleted) {
DCHECK(!finished_);
@@ -49,20 +49,21 @@ void LevelDBTransaction::Set(const StringPiece& key,
record->deleted = deleted;
data_[record->key] = record;
NotifyIterators();
- return;
+ return false;
}
-
+ bool replaced_deleted_value = it->second->deleted;
it->second->value.swap(*value);
it->second->deleted = deleted;
+ return replaced_deleted_value;
}
void LevelDBTransaction::Put(const StringPiece& key, std::string* value) {
Set(key, value, false);
}
-void LevelDBTransaction::Remove(const StringPiece& key) {
+bool LevelDBTransaction::Remove(const StringPiece& key) {
std::string empty;
- Set(key, &empty, true);
+ return !Set(key, &empty, true);
}
leveldb::Status LevelDBTransaction::Get(const StringPiece& key,

Powered by Google App Engine
This is Rietveld 408576698