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

Side by Side Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged out--bot failed due to staleness. Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 #include <set> 8 #include <set>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 base::Passed(&key_range), 1200 base::Passed(&key_range),
1201 callbacks)); 1201 callbacks));
1202 } 1202 }
1203 1203
1204 void IndexedDBDatabase::DeleteRangeOperation( 1204 void IndexedDBDatabase::DeleteRangeOperation(
1205 int64 object_store_id, 1205 int64 object_store_id,
1206 scoped_ptr<IndexedDBKeyRange> key_range, 1206 scoped_ptr<IndexedDBKeyRange> key_range,
1207 scoped_refptr<IndexedDBCallbacks> callbacks, 1207 scoped_refptr<IndexedDBCallbacks> callbacks,
1208 IndexedDBTransaction* transaction) { 1208 IndexedDBTransaction* transaction) {
1209 IDB_TRACE("IndexedDBDatabase::DeleteRangeOperation"); 1209 IDB_TRACE("IndexedDBDatabase::DeleteRangeOperation");
1210 leveldb::Status s; 1210 leveldb::Status s =
1211 scoped_ptr<IndexedDBBackingStore::Cursor> backing_store_cursor = 1211 backing_store_->DeleteRange(transaction->BackingStoreTransaction(),
1212 backing_store_->OpenObjectStoreCursor( 1212 id(),
1213 transaction->BackingStoreTransaction(), 1213 object_store_id,
1214 id(), 1214 *key_range);
1215 object_store_id,
1216 *key_range,
1217 indexed_db::CURSOR_NEXT,
1218 &s);
1219 if (backing_store_cursor && s.ok()) {
1220 do {
1221 if (!backing_store_->DeleteRecord(
1222 transaction->BackingStoreTransaction(),
1223 id(),
1224 object_store_id,
1225 backing_store_cursor->record_identifier())
1226 .ok()) {
1227 callbacks->OnError(
1228 IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
1229 "Internal error deleting data in range"));
1230 return;
1231 }
1232 } while (backing_store_cursor->Continue(&s));
1233 }
1234
1235 if (!s.ok()) { 1215 if (!s.ok()) {
1216 base::string16 error_string =
1217 ASCIIToUTF16("Internal error deleting data in range");
1236 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, 1218 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
1237 ASCIIToUTF16("Internal error deleting range")); 1219 error_string);
1238 transaction->Abort(error); 1220 transaction->Abort(error);
1239 if (leveldb_env::IsCorruption(s)) { 1221 if (leveldb_env::IsCorruption(s)) {
1240 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), 1222 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
1241 error); 1223 error);
1242 } 1224 }
1243 return; 1225 return;
1244 } 1226 }
1245
1246 callbacks->OnSuccess(); 1227 callbacks->OnSuccess();
1247 } 1228 }
1248 1229
1249 void IndexedDBDatabase::Clear(int64 transaction_id, 1230 void IndexedDBDatabase::Clear(int64 transaction_id,
1250 int64 object_store_id, 1231 int64 object_store_id,
1251 scoped_refptr<IndexedDBCallbacks> callbacks) { 1232 scoped_refptr<IndexedDBCallbacks> callbacks) {
1252 IDB_TRACE("IndexedDBDatabase::Clear"); 1233 IDB_TRACE("IndexedDBDatabase::Clear");
1253 IndexedDBTransaction* transaction = GetTransaction(transaction_id); 1234 IndexedDBTransaction* transaction = GetTransaction(transaction_id);
1254 if (!transaction) 1235 if (!transaction)
1255 return; 1236 return;
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 const base::string16& previous_version, 1743 const base::string16& previous_version,
1763 int64 previous_int_version, 1744 int64 previous_int_version,
1764 IndexedDBTransaction* transaction) { 1745 IndexedDBTransaction* transaction) {
1765 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 1746 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
1766 DCHECK(!transaction); 1747 DCHECK(!transaction);
1767 metadata_.version = previous_version; 1748 metadata_.version = previous_version;
1768 metadata_.int_version = previous_int_version; 1749 metadata_.int_version = previous_int_version;
1769 } 1750 }
1770 1751
1771 } // namespace content 1752 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_context_impl.cc ('k') | content/browser/indexed_db/indexed_db_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698