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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 if (int_version == IndexedDBDatabaseMetadata::NO_INT_VERSION) | 795 if (int_version == IndexedDBDatabaseMetadata::NO_INT_VERSION) |
796 int_version = IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION; | 796 int_version = IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION; |
797 DCHECK_GE(int_version, 0) << "int_version was " << int_version; | 797 DCHECK_GE(int_version, 0) << "int_version was " << int_version; |
798 PutVarInt(transaction->transaction(), | 798 PutVarInt(transaction->transaction(), |
799 DatabaseMetaDataKey::Encode(row_id, | 799 DatabaseMetaDataKey::Encode(row_id, |
800 DatabaseMetaDataKey::USER_INT_VERSION), | 800 DatabaseMetaDataKey::USER_INT_VERSION), |
801 int_version); | 801 int_version); |
802 return true; | 802 return true; |
803 } | 803 } |
804 | 804 |
805 bool IndexedDBBackingStore::UpdateIDBDatabaseMetaData( | |
806 IndexedDBBackingStore::Transaction* transaction, | |
807 int64 row_id, | |
808 const string16& version) { | |
809 PutString( | |
810 transaction->transaction(), | |
811 DatabaseMetaDataKey::Encode(row_id, DatabaseMetaDataKey::USER_VERSION), | |
812 version); | |
813 return true; | |
814 } | |
815 | |
816 static void DeleteRange(LevelDBTransaction* transaction, | 805 static void DeleteRange(LevelDBTransaction* transaction, |
817 const std::string& begin, | 806 const std::string& begin, |
818 const std::string& end) { | 807 const std::string& end) { |
819 scoped_ptr<LevelDBIterator> it = transaction->CreateIterator(); | 808 scoped_ptr<LevelDBIterator> it = transaction->CreateIterator(); |
820 for (it->Seek(begin); it->IsValid() && CompareKeys(it->Key(), end) < 0; | 809 for (it->Seek(begin); it->IsValid() && CompareKeys(it->Key(), end) < 0; |
821 it->Next()) | 810 it->Next()) |
822 transaction->Remove(it->Key()); | 811 transaction->Remove(it->Key()); |
823 } | 812 } |
824 | 813 |
825 bool IndexedDBBackingStore::DeleteDatabase(const string16& name) { | 814 bool IndexedDBBackingStore::DeleteDatabase(const string16& name) { |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2574 } | 2563 } |
2575 | 2564 |
2576 void IndexedDBBackingStore::Transaction::Rollback() { | 2565 void IndexedDBBackingStore::Transaction::Rollback() { |
2577 IDB_TRACE("IndexedDBBackingStore::Transaction::Rollback"); | 2566 IDB_TRACE("IndexedDBBackingStore::Transaction::Rollback"); |
2578 DCHECK(transaction_.get()); | 2567 DCHECK(transaction_.get()); |
2579 transaction_->Rollback(); | 2568 transaction_->Rollback(); |
2580 transaction_ = NULL; | 2569 transaction_ = NULL; |
2581 } | 2570 } |
2582 | 2571 |
2583 } // namespace content | 2572 } // namespace content |
OLD | NEW |