| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <utility> | 15 #include <utility> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 19 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 22 #include "base/memory/weak_ptr.h" |
| 22 #include "base/strings/string_piece.h" | 23 #include "base/strings/string_piece.h" |
| 23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 24 #include "base/timer/timer.h" | 25 #include "base/timer/timer.h" |
| 25 #include "content/browser/indexed_db/indexed_db.h" | 26 #include "content/browser/indexed_db/indexed_db.h" |
| 26 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h" | 27 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h" |
| 27 #include "content/browser/indexed_db/indexed_db_blob_info.h" | 28 #include "content/browser/indexed_db/indexed_db_blob_info.h" |
| 28 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 29 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
| 29 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 30 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
| 30 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 31 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
| 31 #include "content/common/content_export.h" | 32 #include "content/common/content_export.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 private: | 86 private: |
| 86 // TODO(jsbell): Make it more clear that this is the *encoded* version of | 87 // TODO(jsbell): Make it more clear that this is the *encoded* version of |
| 87 // the key. | 88 // the key. |
| 88 std::string primary_key_; | 89 std::string primary_key_; |
| 89 int64_t version_; | 90 int64_t version_; |
| 90 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); | 91 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 class BlobWriteCallback : public base::RefCounted<BlobWriteCallback> { | 94 class BlobWriteCallback : public base::RefCounted<BlobWriteCallback> { |
| 94 public: | 95 public: |
| 95 virtual void Run(bool succeeded) = 0; | 96 // TODO(dmurph): Make all calls to this method async after measuring |
| 97 // performance. |
| 98 virtual leveldb::Status Run(bool succeeded, bool sync_call) = 0; |
| 96 | 99 |
| 97 protected: | 100 protected: |
| 98 friend class base::RefCounted<BlobWriteCallback>; | 101 friend class base::RefCounted<BlobWriteCallback>; |
| 99 virtual ~BlobWriteCallback() {} | 102 virtual ~BlobWriteCallback() {} |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 class BlobChangeRecord { | 105 class BlobChangeRecord { |
| 103 public: | 106 public: |
| 104 BlobChangeRecord(const std::string& key, int64_t object_store_id); | 107 BlobChangeRecord(const std::string& key, int64_t object_store_id); |
| 105 ~BlobChangeRecord(); | 108 ~BlobChangeRecord(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // be added to either the primary or live blob journal as appropriate | 278 // be added to either the primary or live blob journal as appropriate |
| 276 // following a successful commit. | 279 // following a successful commit. |
| 277 BlobJournalType blobs_to_remove_; | 280 BlobJournalType blobs_to_remove_; |
| 278 scoped_refptr<ChainedBlobWriter> chained_blob_writer_; | 281 scoped_refptr<ChainedBlobWriter> chained_blob_writer_; |
| 279 | 282 |
| 280 // Set to true between CommitPhaseOne and CommitPhaseTwo/Rollback, to | 283 // Set to true between CommitPhaseOne and CommitPhaseTwo/Rollback, to |
| 281 // indicate that the committing_transaction_count_ on the backing store | 284 // indicate that the committing_transaction_count_ on the backing store |
| 282 // has been bumped, and journal cleaning should be deferred. | 285 // has been bumped, and journal cleaning should be deferred. |
| 283 bool committing_; | 286 bool committing_; |
| 284 | 287 |
| 288 base::WeakPtrFactory<Transaction> ptr_factory_; |
| 289 |
| 285 DISALLOW_COPY_AND_ASSIGN(Transaction); | 290 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 286 }; | 291 }; |
| 287 | 292 |
| 288 class Cursor { | 293 class Cursor { |
| 289 public: | 294 public: |
| 290 enum IteratorState { READY = 0, SEEK }; | 295 enum IteratorState { READY = 0, SEEK }; |
| 291 | 296 |
| 292 virtual ~Cursor(); | 297 virtual ~Cursor(); |
| 293 | 298 |
| 294 struct CursorOptions { | 299 struct CursorOptions { |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 // complete. While > 0, temporary journal entries may exist so out-of-band | 692 // complete. While > 0, temporary journal entries may exist so out-of-band |
| 688 // journal cleaning must be deferred. | 693 // journal cleaning must be deferred. |
| 689 size_t committing_transaction_count_; | 694 size_t committing_transaction_count_; |
| 690 | 695 |
| 691 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); | 696 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); |
| 692 }; | 697 }; |
| 693 | 698 |
| 694 } // namespace content | 699 } // namespace content |
| 695 | 700 |
| 696 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 701 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |