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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 IndexedDBBackingStore::Transaction* transaction, | 192 IndexedDBBackingStore::Transaction* transaction, |
193 int64 database_id, | 193 int64 database_id, |
194 int64 object_store_id, | 194 int64 object_store_id, |
195 const IndexedDBKey& key, | 195 const IndexedDBKey& key, |
196 IndexedDBValue* record) WARN_UNUSED_RESULT; | 196 IndexedDBValue* record) WARN_UNUSED_RESULT; |
197 virtual leveldb::Status PutRecord( | 197 virtual leveldb::Status PutRecord( |
198 IndexedDBBackingStore::Transaction* transaction, | 198 IndexedDBBackingStore::Transaction* transaction, |
199 int64 database_id, | 199 int64 database_id, |
200 int64 object_store_id, | 200 int64 object_store_id, |
201 const IndexedDBKey& key, | 201 const IndexedDBKey& key, |
202 IndexedDBValue& value, | 202 IndexedDBValue* value, |
203 ScopedVector<webkit_blob::BlobDataHandle>* handles, | 203 ScopedVector<webkit_blob::BlobDataHandle>* handles, |
204 RecordIdentifier* record) WARN_UNUSED_RESULT; | 204 RecordIdentifier* record) WARN_UNUSED_RESULT; |
205 virtual leveldb::Status ClearObjectStore( | 205 virtual leveldb::Status ClearObjectStore( |
206 IndexedDBBackingStore::Transaction* transaction, | 206 IndexedDBBackingStore::Transaction* transaction, |
207 int64 database_id, | 207 int64 database_id, |
208 int64 object_store_id) WARN_UNUSED_RESULT; | 208 int64 object_store_id) WARN_UNUSED_RESULT; |
209 virtual leveldb::Status DeleteRecord( | 209 virtual leveldb::Status DeleteRecord( |
210 IndexedDBBackingStore::Transaction* transaction, | 210 IndexedDBBackingStore::Transaction* transaction, |
211 int64 database_id, | 211 int64 database_id, |
212 int64 object_store_id, | 212 int64 object_store_id, |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 490 |
491 private: | 491 private: |
492 class BlobWriteCallbackWrapper; | 492 class BlobWriteCallbackWrapper; |
493 | 493 |
494 leveldb::Status HandleBlobPreTransaction( | 494 leveldb::Status HandleBlobPreTransaction( |
495 BlobEntryKeyValuePairVec* new_blob_entries, | 495 BlobEntryKeyValuePairVec* new_blob_entries, |
496 WriteDescriptorVec* new_files_to_write); | 496 WriteDescriptorVec* new_files_to_write); |
497 // Returns true on success, false on failure. | 497 // Returns true on success, false on failure. |
498 bool CollectBlobFilesToRemove(); | 498 bool CollectBlobFilesToRemove(); |
499 // The callback will be called eventually on success or failure. | 499 // The callback will be called eventually on success or failure. |
500 void WriteNewBlobs(BlobEntryKeyValuePairVec& new_blob_entries, | 500 void WriteNewBlobs(BlobEntryKeyValuePairVec* new_blob_entries, |
501 WriteDescriptorVec& new_files_to_write, | 501 WriteDescriptorVec* new_files_to_write, |
502 scoped_refptr<BlobWriteCallback> callback); | 502 scoped_refptr<BlobWriteCallback> callback); |
503 leveldb::Status SortBlobsToRemove(); | 503 leveldb::Status SortBlobsToRemove(); |
504 | 504 |
505 IndexedDBBackingStore* backing_store_; | 505 IndexedDBBackingStore* backing_store_; |
506 scoped_refptr<LevelDBTransaction> transaction_; | 506 scoped_refptr<LevelDBTransaction> transaction_; |
507 BlobChangeMap blob_change_map_; | 507 BlobChangeMap blob_change_map_; |
508 BlobChangeMap incognito_blob_map_; | 508 BlobChangeMap incognito_blob_map_; |
509 int64 database_id_; | 509 int64 database_id_; |
510 BlobJournalType blobs_to_remove_; | 510 BlobJournalType blobs_to_remove_; |
511 scoped_refptr<ChainedBlobWriter> chained_blob_writer_; | 511 scoped_refptr<ChainedBlobWriter> chained_blob_writer_; |
(...skipping 28 matching lines...) Expand all Loading... |
540 const GURL& origin_url, | 540 const GURL& origin_url, |
541 const base::FilePath& blob_path, | 541 const base::FilePath& blob_path, |
542 net::URLRequestContext* request_context, | 542 net::URLRequestContext* request_context, |
543 scoped_ptr<LevelDBDatabase> db, | 543 scoped_ptr<LevelDBDatabase> db, |
544 scoped_ptr<LevelDBComparator> comparator, | 544 scoped_ptr<LevelDBComparator> comparator, |
545 base::TaskRunner* task_runner, | 545 base::TaskRunner* task_runner, |
546 leveldb::Status* status); | 546 leveldb::Status* status); |
547 | 547 |
548 static bool ReadCorruptionInfo(const base::FilePath& path_base, | 548 static bool ReadCorruptionInfo(const base::FilePath& path_base, |
549 const GURL& origin_url, | 549 const GURL& origin_url, |
550 std::string& message); | 550 std::string* message); |
551 | 551 |
552 leveldb::Status FindKeyInIndex( | 552 leveldb::Status FindKeyInIndex( |
553 IndexedDBBackingStore::Transaction* transaction, | 553 IndexedDBBackingStore::Transaction* transaction, |
554 int64 database_id, | 554 int64 database_id, |
555 int64 object_store_id, | 555 int64 object_store_id, |
556 int64 index_id, | 556 int64 index_id, |
557 const IndexedDBKey& key, | 557 const IndexedDBKey& key, |
558 std::string* found_encoded_primary_key, | 558 std::string* found_encoded_primary_key, |
559 bool* found); | 559 bool* found); |
560 leveldb::Status GetIndexes(int64 database_id, | 560 leveldb::Status GetIndexes(int64 database_id, |
(...skipping 27 matching lines...) Expand all Loading... |
588 // will hold a reference to this backing store. | 588 // will hold a reference to this backing store. |
589 IndexedDBActiveBlobRegistry active_blob_registry_; | 589 IndexedDBActiveBlobRegistry active_blob_registry_; |
590 base::OneShotTimer<IndexedDBBackingStore> close_timer_; | 590 base::OneShotTimer<IndexedDBBackingStore> close_timer_; |
591 | 591 |
592 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); | 592 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); |
593 }; | 593 }; |
594 | 594 |
595 } // namespace content | 595 } // namespace content |
596 | 596 |
597 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 597 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
OLD | NEW |