| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // TODO(jsbell): Make it more clear that this is the *encoded* version of | 168 // TODO(jsbell): Make it more clear that this is the *encoded* version of |
| 169 // the key. | 169 // the key. |
| 170 std::string primary_key_; | 170 std::string primary_key_; |
| 171 int64 version_; | 171 int64 version_; |
| 172 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); | 172 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 class BlobWriteCallback : public base::RefCounted<BlobWriteCallback> { | 175 class BlobWriteCallback : public base::RefCounted<BlobWriteCallback> { |
| 176 public: | 176 public: |
| 177 virtual void Run(bool succeeded) = 0; | 177 virtual void Run(bool succeeded) = 0; |
| 178 |
| 178 protected: | 179 protected: |
| 179 virtual ~BlobWriteCallback() {} | 180 virtual ~BlobWriteCallback() {} |
| 180 friend class base::RefCounted<BlobWriteCallback>; | 181 friend class base::RefCounted<BlobWriteCallback>; |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 virtual leveldb::Status GetRecord( | 184 virtual leveldb::Status GetRecord( |
| 184 IndexedDBBackingStore::Transaction* transaction, | 185 IndexedDBBackingStore::Transaction* transaction, |
| 185 int64 database_id, | 186 int64 database_id, |
| 186 int64 object_store_id, | 187 int64 object_store_id, |
| 187 const IndexedDBKey& key, | 188 const IndexedDBKey& key, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 bool IsPastBounds() const; | 327 bool IsPastBounds() const; |
| 327 bool HaveEnteredRange() const; | 328 bool HaveEnteredRange() const; |
| 328 | 329 |
| 329 IndexedDBBackingStore* backing_store_; | 330 IndexedDBBackingStore* backing_store_; |
| 330 Transaction* transaction_; | 331 Transaction* transaction_; |
| 331 int64 database_id_; | 332 int64 database_id_; |
| 332 const CursorOptions cursor_options_; | 333 const CursorOptions cursor_options_; |
| 333 scoped_ptr<LevelDBIterator> iterator_; | 334 scoped_ptr<LevelDBIterator> iterator_; |
| 334 scoped_ptr<IndexedDBKey> current_key_; | 335 scoped_ptr<IndexedDBKey> current_key_; |
| 335 IndexedDBBackingStore::RecordIdentifier record_identifier_; | 336 IndexedDBBackingStore::RecordIdentifier record_identifier_; |
| 337 |
| 338 private: |
| 339 DISALLOW_COPY_AND_ASSIGN(Cursor); |
| 336 }; | 340 }; |
| 337 | 341 |
| 338 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( | 342 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( |
| 339 IndexedDBBackingStore::Transaction* transaction, | 343 IndexedDBBackingStore::Transaction* transaction, |
| 340 int64 database_id, | 344 int64 database_id, |
| 341 int64 object_store_id, | 345 int64 object_store_id, |
| 342 const IndexedDBKeyRange& key_range, | 346 const IndexedDBKeyRange& key_range, |
| 343 indexed_db::CursorDirection, | 347 indexed_db::CursorDirection, |
| 344 leveldb::Status*); | 348 leveldb::Status*); |
| 345 virtual scoped_ptr<Cursor> OpenObjectStoreCursor( | 349 virtual scoped_ptr<Cursor> OpenObjectStoreCursor( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // TODO(ericu): Add a reason in the event of failure. | 456 // TODO(ericu): Add a reason in the event of failure. |
| 453 virtual void ReportWriteCompletion(bool succeeded, | 457 virtual void ReportWriteCompletion(bool succeeded, |
| 454 int64 bytes_written) = 0; | 458 int64 bytes_written) = 0; |
| 455 | 459 |
| 456 virtual void Abort() = 0; | 460 virtual void Abort() = 0; |
| 457 | 461 |
| 458 protected: | 462 protected: |
| 459 virtual ~ChainedBlobWriter() {} | 463 virtual ~ChainedBlobWriter() {} |
| 460 friend class base::RefCounted<ChainedBlobWriter>; | 464 friend class base::RefCounted<ChainedBlobWriter>; |
| 461 }; | 465 }; |
| 466 |
| 462 class ChainedBlobWriterImpl; | 467 class ChainedBlobWriterImpl; |
| 463 | 468 |
| 464 typedef std::vector<WriteDescriptor> WriteDescriptorVec; | 469 typedef std::vector<WriteDescriptor> WriteDescriptorVec; |
| 465 | 470 |
| 466 private: | 471 private: |
| 467 class BlobWriteCallbackWrapper; | 472 class BlobWriteCallbackWrapper; |
| 468 | 473 |
| 469 leveldb::Status HandleBlobPreTransaction( | 474 leveldb::Status HandleBlobPreTransaction( |
| 470 BlobEntryKeyValuePairVec* new_blob_entries, | 475 BlobEntryKeyValuePairVec* new_blob_entries, |
| 471 WriteDescriptorVec* new_files_to_write); | 476 WriteDescriptorVec* new_files_to_write); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 std::set<int> child_process_ids_granted_; | 560 std::set<int> child_process_ids_granted_; |
| 556 BlobChangeMap incognito_blob_map_; | 561 BlobChangeMap incognito_blob_map_; |
| 557 base::OneShotTimer<IndexedDBBackingStore> journal_cleaning_timer_; | 562 base::OneShotTimer<IndexedDBBackingStore> journal_cleaning_timer_; |
| 558 | 563 |
| 559 scoped_ptr<LevelDBDatabase> db_; | 564 scoped_ptr<LevelDBDatabase> db_; |
| 560 scoped_ptr<LevelDBComparator> comparator_; | 565 scoped_ptr<LevelDBComparator> comparator_; |
| 561 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ | 566 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ |
| 562 // will hold a reference to this backing store. | 567 // will hold a reference to this backing store. |
| 563 IndexedDBActiveBlobRegistry active_blob_registry_; | 568 IndexedDBActiveBlobRegistry active_blob_registry_; |
| 564 base::OneShotTimer<IndexedDBBackingStore> close_timer_; | 569 base::OneShotTimer<IndexedDBBackingStore> close_timer_; |
| 570 |
| 571 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); |
| 565 }; | 572 }; |
| 566 | 573 |
| 567 } // namespace content | 574 } // namespace content |
| 568 | 575 |
| 569 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 576 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |