Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_ | |
| 6 #define CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "content/common/indexed_db/indexed_db.mojom.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 class IndexedDBConnection; | |
| 14 class IndexedDBDispatcherHost; | |
| 15 | |
| 16 class DatabaseImpl : public ::indexed_db::mojom::Database { | |
| 17 public: | |
| 18 explicit DatabaseImpl(std::unique_ptr<IndexedDBConnection> connection, | |
| 19 const url::Origin& origin, | |
| 20 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host); | |
| 21 ~DatabaseImpl() override; | |
| 22 | |
| 23 // ::indexed_db::mojom::Database implementation | |
| 24 void CreateObjectStore(int64_t transaction_id, | |
| 25 int64_t object_store_id, | |
| 26 const base::string16& name, | |
| 27 const IndexedDBKeyPath& key_path, | |
| 28 bool auto_increment) override; | |
| 29 void DeleteObjectStore(int64_t transaction_id, | |
| 30 int64_t object_store_id) override; | |
| 31 void RenameObjectStore(int64_t transaction_id, | |
| 32 int64_t object_store_id, | |
| 33 const base::string16& new_name) override; | |
| 34 void CreateTransaction(int64_t transaction_id, | |
| 35 const std::vector<int64_t>& object_store_ids, | |
| 36 blink::WebIDBTransactionMode mode) override; | |
| 37 void Close() override; | |
| 38 void VersionChangeIgnored() override; | |
| 39 void AddObserver(int64_t transaction_id, | |
| 40 int32_t observer_id, | |
| 41 bool include_transaction, | |
| 42 bool no_records, | |
| 43 bool values, | |
| 44 uint16_t operation_types) override; | |
| 45 void RemoveObservers(const std::vector<int32_t>& observers) override; | |
| 46 void Get(int64_t transaction_id, | |
| 47 int64_t object_store_id, | |
| 48 int64_t index_id, | |
| 49 const IndexedDBKeyRange& key_range, | |
| 50 bool key_only, | |
| 51 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; | |
| 52 void GetAll( | |
| 53 int64_t transaction_id, | |
| 54 int64_t object_store_id, | |
| 55 int64_t index_id, | |
| 56 const IndexedDBKeyRange& key_range, | |
| 57 bool key_only, | |
| 58 int64_t max_count, | |
| 59 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; | |
| 60 void Put(int64_t transaction_id, | |
| 61 int64_t object_store_id, | |
| 62 indexed_db::mojom::ValuePtr value, | |
| 63 const IndexedDBKey& key, | |
| 64 blink::WebIDBPutMode mode, | |
| 65 const std::vector<IndexedDBIndexKeys>& index_keys, | |
| 66 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; | |
| 67 void SetIndexKeys(int64_t transaction_id, | |
| 68 int64_t object_store_id, | |
| 69 const IndexedDBKey& primary_key, | |
| 70 const std::vector<IndexedDBIndexKeys>& index_keys) override; | |
| 71 void SetIndexesReady(int64_t transaction_id, | |
| 72 int64_t object_store_id, | |
| 73 const std::vector<int64_t>& index_ids) override; | |
| 74 void OpenCursor( | |
| 75 int64_t transaction_id, | |
| 76 int64_t object_store_id, | |
| 77 int64_t index_id, | |
| 78 const IndexedDBKeyRange& key_range, | |
| 79 blink::WebIDBCursorDirection direction, | |
| 80 bool key_only, | |
| 81 blink::WebIDBTaskType task_type, | |
| 82 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) override; | |
| 83 void Count( | |
| 84 int64_t transaction_id, | |
| 85 int64_t object_store_id, | |
| 86 int64_t index_id, | |
| 87 const IndexedDBKeyRange& key_range, | |
| 88 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; | |
| 89 void DeleteRange( | |
| 90 int64_t transaction_id, | |
| 91 int64_t object_store_id, | |
| 92 const IndexedDBKeyRange& key_range, | |
| 93 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; | |
| 94 void Clear( | |
| 95 int64_t transaction_id, | |
| 96 int64_t object_store_id, | |
| 97 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; | |
| 98 void CreateIndex(int64_t transaction_id, | |
| 99 int64_t object_store_id, | |
| 100 int64_t index_id, | |
| 101 const base::string16& name, | |
| 102 const IndexedDBKeyPath& key_path, | |
| 103 bool unique, | |
| 104 bool multi_entry) override; | |
| 105 void DeleteIndex(int64_t transaction_id, | |
| 106 int64_t object_store_id, | |
| 107 int64_t index_id) override; | |
| 108 void RenameIndex(int64_t transaction_id, | |
| 109 int64_t object_store_id, | |
| 110 int64_t index_id, | |
| 111 const base::string16& new_name) override; | |
| 112 void Abort(int64_t transaction_id) override; | |
| 113 void Commit(int64_t transaction_id) override; | |
| 114 void AckReceivedBlobs(const std::vector<std::string>& uuids) override; | |
| 115 | |
| 116 private: | |
| 117 class IDBThreadHelper; | |
| 118 | |
| 119 IDBThreadHelper* helper_; | |
| 120 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | |
| 121 const url::Origin origin_; | |
| 122 scoped_refptr<base::SingleThreadTaskRunner> idb_runner_; | |
|
cmumford
2016/10/28 18:40:53
DISALLOW_COPY_AND_ASSIGN(DatabaseImpl);
Reilly Grant (use Gerrit)
2016/11/03 21:32:21
Done.
| |
| 123 }; | |
| 124 | |
| 125 } // namespace content | |
| 126 | |
| 127 #endif // CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_ | |
| OLD | NEW |