| 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ~RecordIdentifier(); | 102 ~RecordIdentifier(); |
| 103 | 103 |
| 104 const std::vector<char>& primary_key() const { return primary_key_; } | 104 const std::vector<char>& primary_key() const { return primary_key_; } |
| 105 int64 version() const { return version_; } | 105 int64 version() const { return version_; } |
| 106 void Reset(const std::vector<char>& primary_key, int64 version) { | 106 void Reset(const std::vector<char>& primary_key, int64 version) { |
| 107 primary_key_ = primary_key; | 107 primary_key_ = primary_key; |
| 108 version_ = version; | 108 version_ = version; |
| 109 } | 109 } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 std::vector<char> | 112 // TODO(jsbell): Make it more clear that this is the *encoded* version of |
| 113 primary_key_; // TODO(jsbell): Make it more clear that this is | 113 // the key. |
| 114 // the *encoded* version of the key. | 114 std::vector<char> primary_key_; |
| 115 int64 version_; | 115 int64 version_; |
| 116 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); | 116 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 virtual bool GetRecord(IndexedDBBackingStore::Transaction* transaction, | 119 virtual bool GetRecord(IndexedDBBackingStore::Transaction* transaction, |
| 120 int64 database_id, | 120 int64 database_id, |
| 121 int64 object_store_id, | 121 int64 object_store_id, |
| 122 const IndexedDBKey& key, | 122 const IndexedDBKey& key, |
| 123 std::vector<char>* record) WARN_UNUSED_RESULT; | 123 std::vector<char>* record) WARN_UNUSED_RESULT; |
| 124 virtual bool PutRecord(IndexedDBBackingStore::Transaction* transaction, | 124 virtual bool PutRecord(IndexedDBBackingStore::Transaction* transaction, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void Begin(); | 273 void Begin(); |
| 274 bool Commit(); | 274 bool Commit(); |
| 275 void Rollback(); | 275 void Rollback(); |
| 276 void Reset() { | 276 void Reset() { |
| 277 backing_store_ = NULL; | 277 backing_store_ = NULL; |
| 278 transaction_ = NULL; | 278 transaction_ = NULL; |
| 279 } | 279 } |
| 280 | 280 |
| 281 static LevelDBTransaction* LevelDBTransactionFrom( | 281 static LevelDBTransaction* LevelDBTransactionFrom( |
| 282 Transaction* transaction) { | 282 Transaction* transaction) { |
| 283 return transaction->transaction_.get(); | 283 return transaction->transaction_; |
| 284 } | 284 } |
| 285 | 285 |
| 286 private: | 286 private: |
| 287 IndexedDBBackingStore* backing_store_; | 287 IndexedDBBackingStore* backing_store_; |
| 288 scoped_refptr<LevelDBTransaction> transaction_; | 288 scoped_refptr<LevelDBTransaction> transaction_; |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 protected: | 291 protected: |
| 292 IndexedDBBackingStore(const string16& identifier, | 292 IndexedDBBackingStore(const string16& identifier, |
| 293 scoped_ptr<LevelDBDatabase> db, | 293 scoped_ptr<LevelDBDatabase> db, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 316 string16 identifier_; | 316 string16 identifier_; |
| 317 | 317 |
| 318 scoped_ptr<LevelDBDatabase> db_; | 318 scoped_ptr<LevelDBDatabase> db_; |
| 319 scoped_ptr<LevelDBComparator> comparator_; | 319 scoped_ptr<LevelDBComparator> comparator_; |
| 320 base::WeakPtrFactory<IndexedDBBackingStore> weak_factory_; | 320 base::WeakPtrFactory<IndexedDBBackingStore> weak_factory_; |
| 321 }; | 321 }; |
| 322 | 322 |
| 323 } // namespace content | 323 } // namespace content |
| 324 | 324 |
| 325 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 325 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |