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

Unified Diff: content/browser/indexed_db/indexed_db_database.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: Return number of values deleted by IDBObjectStore.delete(range) Created 4 years, 7 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_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index c686ae87ad3aaa4a86d13e948f644c1f0c8265ba..11054433af2c55b1c352ba1e44df5c3440017823 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -17,6 +17,7 @@
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_vector.h"
#include "base/metrics/histogram_macros.h"
+#include "base/numerics/safe_conversions.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -1410,13 +1411,12 @@ void IndexedDBDatabase::DeleteRangeOperation(
std::unique_ptr<IndexedDBKeyRange> key_range,
scoped_refptr<IndexedDBCallbacks> callbacks,
IndexedDBTransaction* transaction) {
- IDB_TRACE1(
- "IndexedDBDatabase::DeleteRangeOperation", "txn.id", transaction->id());
+ IDB_TRACE1("IndexedDBDatabase::DeleteRangeOperation", "txn.id",
+ transaction->id());
+ size_t delete_count = 0;
leveldb::Status s =
- backing_store_->DeleteRange(transaction->BackingStoreTransaction(),
- id(),
- object_store_id,
- *key_range);
+ backing_store_->DeleteRange(transaction->BackingStoreTransaction(), id(),
+ object_store_id, *key_range, &delete_count);
if (!s.ok()) {
base::string16 error_string =
ASCIIToUTF16("Internal error deleting data in range");
@@ -1428,7 +1428,7 @@ void IndexedDBDatabase::DeleteRangeOperation(
}
return;
}
- callbacks->OnSuccess();
+ callbacks->OnSuccess(base::checked_cast<int64_t>(delete_count));
}
void IndexedDBDatabase::Clear(int64_t transaction_id,

Powered by Google App Engine
This is Rietveld 408576698