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