| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ | 5 #ifndef CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ |
| 6 #define CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ | 6 #define CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "content/common/indexed_db/indexed_db.mojom.h" |
| 15 #include "content/common/indexed_db/indexed_db_constants.h" |
| 13 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCursor.h" | 16 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCursor.h" |
| 14 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabase.h" | 17 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabase.h" |
| 15 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 18 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 16 | 19 |
| 17 namespace blink { | 20 namespace blink { |
| 18 class WebBlobInfo; | 21 class WebBlobInfo; |
| 19 class WebIDBCallbacks; | 22 class WebIDBCallbacks; |
| 20 class WebIDBDatabaseCallbacks; | 23 class WebIDBDatabaseCallbacks; |
| 21 class WebIDBObserver; | 24 class WebIDBObserver; |
| 22 class WebString; | 25 class WebString; |
| 23 } | 26 } |
| 24 | 27 |
| 25 namespace content { | 28 namespace content { |
| 26 class ThreadSafeSender; | 29 class ThreadSafeSender; |
| 27 | 30 |
| 28 class WebIDBDatabaseImpl : public blink::WebIDBDatabase { | 31 class CONTENT_EXPORT WebIDBDatabaseImpl : public blink::WebIDBDatabase { |
| 29 public: | 32 public: |
| 30 WebIDBDatabaseImpl(int32_t ipc_database_id, | 33 WebIDBDatabaseImpl(indexed_db::mojom::DatabaseAssociatedPtrInfo database, |
| 31 ThreadSafeSender* thread_safe_sender); | 34 scoped_refptr<base::SingleThreadTaskRunner> io_runner, |
| 35 scoped_refptr<ThreadSafeSender> thread_safe_sender); |
| 32 ~WebIDBDatabaseImpl() override; | 36 ~WebIDBDatabaseImpl() override; |
| 33 | 37 |
| 34 // blink::WebIDBDatabase | 38 // blink::WebIDBDatabase |
| 35 void createObjectStore(long long transaction_id, | 39 void createObjectStore(long long transaction_id, |
| 36 long long objectstore_id, | 40 long long objectstore_id, |
| 37 const blink::WebString& name, | 41 const blink::WebString& name, |
| 38 const blink::WebIDBKeyPath& key_path, | 42 const blink::WebIDBKeyPath& key_path, |
| 39 bool auto_increment) override; | 43 bool auto_increment) override; |
| 40 void deleteObjectStore(long long transaction_id, | 44 void deleteObjectStore(long long transaction_id, |
| 41 long long object_store_id) override; | 45 long long object_store_id) override; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void renameIndex(long long transactionId, | 121 void renameIndex(long long transactionId, |
| 118 long long objectStoreId, | 122 long long objectStoreId, |
| 119 long long indexId, | 123 long long indexId, |
| 120 const blink::WebString& new_name) override; | 124 const blink::WebString& new_name) override; |
| 121 void abort(long long transaction_id) override; | 125 void abort(long long transaction_id) override; |
| 122 void commit(long long transaction_id) override; | 126 void commit(long long transaction_id) override; |
| 123 void ackReceivedBlobs( | 127 void ackReceivedBlobs( |
| 124 const blink::WebVector<blink::WebString>& uuids) override; | 128 const blink::WebVector<blink::WebString>& uuids) override; |
| 125 | 129 |
| 126 private: | 130 private: |
| 127 int32_t ipc_database_id_; | 131 FRIEND_TEST_ALL_PREFIXES(WebIDBDatabaseImplTest, ValueSizeTest); |
| 132 FRIEND_TEST_ALL_PREFIXES(WebIDBDatabaseImplTest, KeyAndValueSizeTest); |
| 133 |
| 134 class IOThreadHelper; |
| 135 |
| 136 // Maximum size (in bytes) of value/key pair allowed for put requests. Any |
| 137 // requests larger than this size will be rejected. |
| 138 // Used by unit tests to exercise behavior without allocating huge chunks |
| 139 // of memory. |
| 140 size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes; |
| 141 |
| 142 IOThreadHelper* helper_; |
| 128 std::set<int32_t> observer_ids_; | 143 std::set<int32_t> observer_ids_; |
| 144 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; |
| 129 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 145 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 130 }; | 146 }; |
| 131 | 147 |
| 132 } // namespace content | 148 } // namespace content |
| 133 | 149 |
| 134 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ | 150 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ |
| OLD | NEW |