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

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

Issue 2449953008: Port messages sent by WebIDBDatabaseImpl to Mojo. (Closed)
Patch Set: Address more comments from dcheng@. 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 WebIDBObserver; 23 class WebIDBObserver;
21 class WebString; 24 class WebString;
22 } 25 }
23 26
24 namespace content { 27 namespace content {
25 class ThreadSafeSender; 28 class ThreadSafeSender;
26 29
27 class WebIDBDatabaseImpl : public blink::WebIDBDatabase { 30 class CONTENT_EXPORT WebIDBDatabaseImpl
31 : public NON_EXPORTED_BASE(blink::WebIDBDatabase) {
28 public: 32 public:
29 WebIDBDatabaseImpl(int32_t ipc_database_id, 33 WebIDBDatabaseImpl(indexed_db::mojom::DatabaseAssociatedPtrInfo database,
30 ThreadSafeSender* thread_safe_sender); 34 scoped_refptr<base::SingleThreadTaskRunner> io_runner,
35 scoped_refptr<ThreadSafeSender> thread_safe_sender);
31 ~WebIDBDatabaseImpl() override; 36 ~WebIDBDatabaseImpl() override;
32 37
33 // blink::WebIDBDatabase 38 // blink::WebIDBDatabase
34 void createObjectStore(long long transaction_id, 39 void createObjectStore(long long transaction_id,
35 long long objectstore_id, 40 long long objectstore_id,
36 const blink::WebString& name, 41 const blink::WebString& name,
37 const blink::WebIDBKeyPath& key_path, 42 const blink::WebIDBKeyPath& key_path,
38 bool auto_increment) override; 43 bool auto_increment) override;
39 void deleteObjectStore(long long transaction_id, 44 void deleteObjectStore(long long transaction_id,
40 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
116 void renameIndex(long long transactionId, 121 void renameIndex(long long transactionId,
117 long long objectStoreId, 122 long long objectStoreId,
118 long long indexId, 123 long long indexId,
119 const blink::WebString& new_name) override; 124 const blink::WebString& new_name) override;
120 void abort(long long transaction_id) override; 125 void abort(long long transaction_id) override;
121 void commit(long long transaction_id) override; 126 void commit(long long transaction_id) override;
122 void ackReceivedBlobs( 127 void ackReceivedBlobs(
123 const blink::WebVector<blink::WebString>& uuids) override; 128 const blink::WebVector<blink::WebString>& uuids) override;
124 129
125 private: 130 private:
126 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_;
127 std::set<int32_t> observer_ids_; 143 std::set<int32_t> observer_ids_;
144 scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
128 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 145 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
129 }; 146 };
130 147
131 } // namespace content 148 } // namespace content
132 149
133 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ 150 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/indexed_db/indexed_db_dispatcher_unittest.cc ('k') | content/child/indexed_db/webidbdatabase_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698