Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: content/child/indexed_db/webidbdatabase_impl.h

Issue 2449953008: Port messages sent by WebIDBDatabaseImpl to Mojo. (Closed)
Patch Set: Address dcheng@'s comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
32 : public NON_EXPORTED_BASE(blink::WebIDBDatabase) {
29 public: 33 public:
30 WebIDBDatabaseImpl(int32_t ipc_database_id, 34 WebIDBDatabaseImpl(indexed_db::mojom::DatabaseAssociatedPtrInfo database,
31 ThreadSafeSender* thread_safe_sender); 35 scoped_refptr<base::SingleThreadTaskRunner> io_runner,
36 scoped_refptr<ThreadSafeSender> thread_safe_sender);
32 ~WebIDBDatabaseImpl() override; 37 ~WebIDBDatabaseImpl() override;
33 38
34 // blink::WebIDBDatabase 39 // blink::WebIDBDatabase
35 void createObjectStore(long long transaction_id, 40 void createObjectStore(long long transaction_id,
36 long long objectstore_id, 41 long long objectstore_id,
37 const blink::WebString& name, 42 const blink::WebString& name,
38 const blink::WebIDBKeyPath& key_path, 43 const blink::WebIDBKeyPath& key_path,
39 bool auto_increment) override; 44 bool auto_increment) override;
40 void deleteObjectStore(long long transaction_id, 45 void deleteObjectStore(long long transaction_id,
41 long long object_store_id) override; 46 long long object_store_id) override;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void renameIndex(long long transactionId, 122 void renameIndex(long long transactionId,
118 long long objectStoreId, 123 long long objectStoreId,
119 long long indexId, 124 long long indexId,
120 const blink::WebString& new_name) override; 125 const blink::WebString& new_name) override;
121 void abort(long long transaction_id) override; 126 void abort(long long transaction_id) override;
122 void commit(long long transaction_id) override; 127 void commit(long long transaction_id) override;
123 void ackReceivedBlobs( 128 void ackReceivedBlobs(
124 const blink::WebVector<blink::WebString>& uuids) override; 129 const blink::WebVector<blink::WebString>& uuids) override;
125 130
126 private: 131 private:
127 int32_t ipc_database_id_; 132 FRIEND_TEST_ALL_PREFIXES(WebIDBDatabaseImplTest, ValueSizeTest);
133 FRIEND_TEST_ALL_PREFIXES(WebIDBDatabaseImplTest, KeyAndValueSizeTest);
134
135 class IOThreadHelper;
136
137 // Maximum size (in bytes) of value/key pair allowed for put requests. Any
138 // requests larger than this size will be rejected.
139 // Used by unit tests to exercise behavior without allocating huge chunks
140 // of memory.
141 size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes;
142
143 IOThreadHelper* helper_;
128 std::set<int32_t> observer_ids_; 144 std::set<int32_t> observer_ids_;
145 scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
129 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 146 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
130 }; 147 };
131 148
132 } // namespace content 149 } // namespace content
133 150
134 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ 151 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698