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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/indexed_db/indexed_db_database.h" 5 #include "content/browser/indexed_db/indexed_db_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 object_store_id, 1403 object_store_id,
1404 base::Passed(&key_range), 1404 base::Passed(&key_range),
1405 callbacks)); 1405 callbacks));
1406 } 1406 }
1407 1407
1408 void IndexedDBDatabase::DeleteRangeOperation( 1408 void IndexedDBDatabase::DeleteRangeOperation(
1409 int64_t object_store_id, 1409 int64_t object_store_id,
1410 std::unique_ptr<IndexedDBKeyRange> key_range, 1410 std::unique_ptr<IndexedDBKeyRange> key_range,
1411 scoped_refptr<IndexedDBCallbacks> callbacks, 1411 scoped_refptr<IndexedDBCallbacks> callbacks,
1412 IndexedDBTransaction* transaction) { 1412 IndexedDBTransaction* transaction) {
1413 IDB_TRACE1( 1413 IDB_TRACE1("IndexedDBDatabase::DeleteRangeOperation", "txn.id",
1414 "IndexedDBDatabase::DeleteRangeOperation", "txn.id", transaction->id()); 1414 transaction->id());
1415 size_t delete_count = 0;
1415 leveldb::Status s = 1416 leveldb::Status s =
1416 backing_store_->DeleteRange(transaction->BackingStoreTransaction(), 1417 backing_store_->DeleteRange(transaction->BackingStoreTransaction(), id(),
1417 id(), 1418 object_store_id, *key_range, &delete_count);
1418 object_store_id,
1419 *key_range);
1420 if (!s.ok()) { 1419 if (!s.ok()) {
1421 base::string16 error_string = 1420 base::string16 error_string =
1422 ASCIIToUTF16("Internal error deleting data in range"); 1421 ASCIIToUTF16("Internal error deleting data in range");
1423 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, 1422 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
1424 error_string); 1423 error_string);
1425 transaction->Abort(error); 1424 transaction->Abort(error);
1426 if (s.IsCorruption()) { 1425 if (s.IsCorruption()) {
1427 factory_->HandleBackingStoreCorruption(backing_store_->origin(), error); 1426 factory_->HandleBackingStoreCorruption(backing_store_->origin(), error);
1428 } 1427 }
1429 return; 1428 return;
1430 } 1429 }
1431 callbacks->OnSuccess(); 1430 callbacks->OnSuccess(delete_count);
cmumford 2016/05/19 17:07:16 You now need to move the "IndexedDBDatabase::Delet
1432 } 1431 }
1433 1432
1434 void IndexedDBDatabase::Clear(int64_t transaction_id, 1433 void IndexedDBDatabase::Clear(int64_t transaction_id,
1435 int64_t object_store_id, 1434 int64_t object_store_id,
1436 scoped_refptr<IndexedDBCallbacks> callbacks) { 1435 scoped_refptr<IndexedDBCallbacks> callbacks) {
1437 IDB_TRACE1("IndexedDBDatabase::Clear", "txn.id", transaction_id); 1436 IDB_TRACE1("IndexedDBDatabase::Clear", "txn.id", transaction_id);
1438 IndexedDBTransaction* transaction = GetTransaction(transaction_id); 1437 IndexedDBTransaction* transaction = GetTransaction(transaction_id);
1439 if (!transaction) 1438 if (!transaction)
1440 return; 1439 return;
1441 DCHECK_NE(transaction->mode(), blink::WebIDBTransactionModeReadOnly); 1440 DCHECK_NE(transaction->mode(), blink::WebIDBTransactionModeReadOnly);
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 1940
1942 void IndexedDBDatabase::VersionChangeAbortOperation( 1941 void IndexedDBDatabase::VersionChangeAbortOperation(
1943 int64_t previous_version, 1942 int64_t previous_version,
1944 IndexedDBTransaction* transaction) { 1943 IndexedDBTransaction* transaction) {
1945 DCHECK(!transaction); 1944 DCHECK(!transaction);
1946 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 1945 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
1947 metadata_.version = previous_version; 1946 metadata_.version = previous_version;
1948 } 1947 }
1949 1948
1950 } // namespace content 1949 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698