Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 if (int_version == IndexedDBDatabaseMetadata::NO_INT_VERSION) | 765 if (int_version == IndexedDBDatabaseMetadata::NO_INT_VERSION) |
| 766 int_version = IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION; | 766 int_version = IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION; |
| 767 DCHECK_GE(int_version, 0) << "int_version was " << int_version; | 767 DCHECK_GE(int_version, 0) << "int_version was " << int_version; |
| 768 PutVarInt(transaction->transaction(), | 768 PutVarInt(transaction->transaction(), |
| 769 DatabaseMetaDataKey::Encode(row_id, | 769 DatabaseMetaDataKey::Encode(row_id, |
| 770 DatabaseMetaDataKey::USER_INT_VERSION), | 770 DatabaseMetaDataKey::USER_INT_VERSION), |
| 771 int_version); | 771 int_version); |
| 772 return true; | 772 return true; |
| 773 } | 773 } |
| 774 | 774 |
| 775 bool IndexedDBBackingStore::UpdateIDBDatabaseMetaData( | |
|
jsbell
2013/11/14 23:34:12
Makes sense - we never update the string version a
| |
| 776 IndexedDBBackingStore::Transaction* transaction, | |
| 777 int64 row_id, | |
| 778 const string16& version) { | |
| 779 PutString( | |
| 780 transaction->transaction(), | |
| 781 DatabaseMetaDataKey::Encode(row_id, DatabaseMetaDataKey::USER_VERSION), | |
| 782 version); | |
| 783 return true; | |
| 784 } | |
| 785 | |
| 786 static void DeleteRange(LevelDBTransaction* transaction, | 775 static void DeleteRange(LevelDBTransaction* transaction, |
| 787 const std::string& begin, | 776 const std::string& begin, |
| 788 const std::string& end) { | 777 const std::string& end) { |
| 789 scoped_ptr<LevelDBIterator> it = transaction->CreateIterator(); | 778 scoped_ptr<LevelDBIterator> it = transaction->CreateIterator(); |
| 790 for (it->Seek(begin); it->IsValid() && CompareKeys(it->Key(), end) < 0; | 779 for (it->Seek(begin); it->IsValid() && CompareKeys(it->Key(), end) < 0; |
| 791 it->Next()) | 780 it->Next()) |
| 792 transaction->Remove(it->Key()); | 781 transaction->Remove(it->Key()); |
| 793 } | 782 } |
| 794 | 783 |
| 795 bool IndexedDBBackingStore::DeleteDatabase(const string16& name) { | 784 bool IndexedDBBackingStore::DeleteDatabase(const string16& name) { |
| (...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2544 } | 2533 } |
| 2545 | 2534 |
| 2546 void IndexedDBBackingStore::Transaction::Rollback() { | 2535 void IndexedDBBackingStore::Transaction::Rollback() { |
| 2547 IDB_TRACE("IndexedDBBackingStore::Transaction::Rollback"); | 2536 IDB_TRACE("IndexedDBBackingStore::Transaction::Rollback"); |
| 2548 DCHECK(transaction_.get()); | 2537 DCHECK(transaction_.get()); |
| 2549 transaction_->Rollback(); | 2538 transaction_->Rollback(); |
| 2550 transaction_ = NULL; | 2539 transaction_ = NULL; |
| 2551 } | 2540 } |
| 2552 | 2541 |
| 2553 } // namespace content | 2542 } // namespace content |
| OLD | NEW |