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

Side by Side Diff: content/common/indexed_db/indexed_db.mojom

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 2016 The Chromium Authors. All rights reserved. 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 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 // TODO: This will move to //third_party/WebKit when //content/child/indexed_db 5 // TODO: This will move to //third_party/WebKit when //content/child/indexed_db
6 // is deleted but for now this will depend on //content/common types and so 6 // is deleted but for now this will depend on //content/common types and so
7 // so belongs here. 7 // so belongs here.
8 8
9 module indexed_db.mojom; 9 module indexed_db.mojom;
10 10
11 import "mojo/common/common_custom_types.mojom"; 11 import "mojo/common/common_custom_types.mojom";
12 import "url/mojo/origin.mojom"; 12 import "url/mojo/origin.mojom";
13 13
14 [Native] 14 [Native]
15 enum CursorDirection;
16
17 [Native]
15 enum DataLoss; 18 enum DataLoss;
16 19
17 [Native] 20 [Native]
21 struct Key;
22
23 [Native]
18 struct KeyPath; 24 struct KeyPath;
19 25
26 [Native]
27 struct KeyRange;
28
29 [Native]
30 enum PutMode;
31
32 [Native]
33 enum TaskType;
34
35 [Native]
36 enum TransactionMode;
37
20 struct IndexMetadata { 38 struct IndexMetadata {
21 int64 id; 39 int64 id;
22 mojo.common.mojom.String16 name; 40 mojo.common.mojom.String16 name;
23 KeyPath key_path; 41 KeyPath key_path;
24 bool unique; 42 bool unique;
25 bool multi_entry; 43 bool multi_entry;
26 }; 44 };
27 45
28 struct ObjectStoreMetadata { 46 struct ObjectStoreMetadata {
29 int64 id; 47 int64 id;
30 mojo.common.mojom.String16 name; 48 mojo.common.mojom.String16 name;
31 KeyPath key_path; 49 KeyPath key_path;
32 bool auto_increment; 50 bool auto_increment;
33 int64 max_index_id; 51 int64 max_index_id;
34 array<IndexMetadata> indexes; 52 array<IndexMetadata> indexes;
35 }; 53 };
36 54
37 struct DatabaseMetadata { 55 struct DatabaseMetadata {
38 int64 id; 56 int64 id;
39 mojo.common.mojom.String16 name; 57 mojo.common.mojom.String16 name;
40 int64 version; 58 int64 version;
41 int64 max_object_store_id; 59 int64 max_object_store_id;
42 array<ObjectStoreMetadata> object_stores; 60 array<ObjectStoreMetadata> object_stores;
43 }; 61 };
44 62
63 struct IndexKeys {
64 int64 index_id;
65 array<Key> index_keys;
66 };
67
68 struct FileInfo {
69 mojo.common.mojom.FilePath path;
70 mojo.common.mojom.String16 name;
71 mojo.common.mojom.Time last_modified;
72 };
73
74 struct BlobInfo {
75 string uuid;
dcheng 2016/11/04 21:37:46 I'm thinking we might want to add a UUID mojo type
Reilly Grant (use Gerrit) 2016/11/04 22:02:54 I agree. I recall WebBluetooth also wanting one.
76 mojo.common.mojom.String16 mime_type;
77 uint64 size;
78 FileInfo? file;
79 };
80
81 struct Value {
82 string bits;
83 array<BlobInfo> blob_or_file_info;
84 };
85
86 struct ReturnValue {
87 Value value;
88 Key primary_key;
89 KeyPath key_path;
90 };
91
45 // The Callbacks interface is used to return results for individual requests. 92 // The Callbacks interface is used to return results for individual requests.
46 // Some requests may return multiple results before completion, such as 93 // Some requests may return multiple results before completion, such as
47 // UpgradeNeeded before SuccessDatabase. 94 // UpgradeNeeded before SuccessDatabase.
48 // 95 //
49 // TODO(https://crbug.com/627484): Many of these could be replaced with 96 // TODO(https://crbug.com/627484): Many of these could be replaced with
50 // replies associated with particular messages. 97 // replies associated with particular messages.
51 interface Callbacks { 98 interface Callbacks {
52 Error(int32 code, mojo.common.mojom.String16 message); 99 Error(int32 code, mojo.common.mojom.String16 message);
53 100
54 // Factory::GetDatabaseNames 101 // Factory::GetDatabaseNames
55 SuccessStringList(array<mojo.common.mojom.String16> value); 102 SuccessStringList(array<mojo.common.mojom.String16> value);
56 103
57 // Factory::Open / DeleteDatabase 104 // Factory::Open / DeleteDatabase
58 Blocked(int64 existing_version); 105 Blocked(int64 existing_version);
59 106
60 // Factory::Open 107 // Factory::Open
61 UpgradeNeeded(int32 database_id, int64 old_version, DataLoss data_loss, 108 UpgradeNeeded(associated Database database, int64 old_version,
62 string data_loss_message, DatabaseMetadata db_metadata); 109 DataLoss data_loss, string data_loss_message,
63 SuccessDatabase(int32 database_id, DatabaseMetadata metadata); 110 DatabaseMetadata db_metadata);
111 SuccessDatabase(associated Database? database, DatabaseMetadata metadata);
64 112
113 // Database::OpenCursor
114 SuccessCursor(int32 cursor_id, Key key, Key primary_key, Value? value);
115
116 // Database::Get / Cursor::Advance
117 SuccessValue(ReturnValue? value);
118
119 // Database::GetAll
120 SuccessArray(array<ReturnValue> values);
121
122 // Database::Put / Cursor::Update
123 SuccessKey(Key key);
124
125 // Database::Count / DeleteRange
65 // Factory::DeleteDatabase 126 // Factory::DeleteDatabase
66 SuccessInteger(int64 value); 127 SuccessInteger(int64 value);
128
129 // Cursor::Continue / Advance
130 Success();
67 }; 131 };
68 132
69 // The DatabaseCallbacks interface is used to notification of events out of 133 // The DatabaseCallbacks interface is used to notification of events out of
70 // band to individual requests. A single instance is used for the lifetime of 134 // band to individual requests. A single instance is used for the lifetime of
71 // a database connection. 135 // a database connection.
72 interface DatabaseCallbacks { 136 interface DatabaseCallbacks {
73 ForcedClose(); 137 ForcedClose();
74 VersionChange(int64 old_version, int64 new_version); 138 VersionChange(int64 old_version, int64 new_version);
75 Abort(int64 transaction_id, int32 code, 139 Abort(int64 transaction_id, int32 code,
76 mojo.common.mojom.String16 message); 140 mojo.common.mojom.String16 message);
77 Complete(int64 transaction_id); 141 Complete(int64 transaction_id);
78 }; 142 };
79 143
144 interface Database {
145 CreateObjectStore(int64 transaction_id,
146 int64 object_store_id,
147 mojo.common.mojom.String16 name,
148 KeyPath key_path,
149 bool auto_increment);
150 DeleteObjectStore(int64 transaction_id,
151 int64 object_store_id);
152 RenameObjectStore(int64 transaction_id,
153 int64 object_store_id,
154 mojo.common.mojom.String16 new_name);
155 CreateTransaction(int64 transaction_id,
156 array<int64> object_store_ids,
157 TransactionMode mode);
158 Close();
159 VersionChangeIgnored();
160 AddObserver(int64 transaction_id,
161 int32 observer_id,
162 bool include_transaction,
163 bool no_records,
164 bool values,
165 uint16 operation_types);
166 RemoveObservers(array<int32> observers);
167 Get(int64 transaction_id,
168 int64 object_store_id,
169 int64 index_id,
170 KeyRange key_range,
171 bool key_only,
172 associated Callbacks callbacks);
173 GetAll(int64 transaction_id,
174 int64 object_store_id,
175 int64 index_id,
176 KeyRange key_range,
177 bool key_only,
178 int64 max_count,
179 associated Callbacks callbacks);
180 Put(int64 transaction_id,
181 int64 object_store_id,
182 Value value,
183 Key key,
184 PutMode mode,
185 array<IndexKeys> index_keys,
186 associated Callbacks callbacks);
187 SetIndexKeys(int64 transaction_id,
188 int64 object_store_id,
189 Key primary_key,
190 array<IndexKeys> index_keys);
191 SetIndexesReady(int64 transaction_id,
192 int64 object_store_id,
193 array<int64> index_ids);
194 OpenCursor(int64 transaction_id,
195 int64 object_store_id,
196 int64 index_id,
197 KeyRange key_range,
198 CursorDirection direction,
199 bool key_only,
200 TaskType task_type,
201 associated Callbacks callbacks);
202 Count(int64 transaction_id,
203 int64 object_store_id,
204 int64 index_id,
205 KeyRange key_range,
206 associated Callbacks callbacks);
207 DeleteRange(int64 transaction_id,
208 int64 object_store_id,
209 KeyRange key_range,
210 associated Callbacks callbacks);
211 Clear(int64 transaction_id,
212 int64 object_store_id,
213 associated Callbacks callbacks);
214 CreateIndex(int64 transaction_id,
215 int64 object_store_id,
216 int64 index_id,
217 mojo.common.mojom.String16 name,
218 KeyPath key_path,
219 bool unique,
220 bool multi_entry);
221 DeleteIndex(int64 transaction_id,
222 int64 object_store_id,
223 int64 index_id);
224 RenameIndex(int64 transaction_id,
225 int64 object_store_id,
226 int64 index_id,
227 mojo.common.mojom.String16 new_name);
228 Abort(int64 transaction_id);
229 Commit(int64 transaction_id);
230 AckReceivedBlobs(array<string> uuids);
231 };
232
80 interface Factory { 233 interface Factory {
81 GetDatabaseNames(associated Callbacks callbacks, url.mojom.Origin origin); 234 GetDatabaseNames(associated Callbacks callbacks, url.mojom.Origin origin);
82 Open(int32 worker_thread, associated Callbacks callbacks, 235 Open(int32 worker_thread, associated Callbacks callbacks,
83 associated DatabaseCallbacks database_callbacks, url.mojom.Origin origin, 236 associated DatabaseCallbacks database_callbacks, url.mojom.Origin origin,
84 mojo.common.mojom.String16 name, int64 version, int64 transaction_id); 237 mojo.common.mojom.String16 name, int64 version, int64 transaction_id);
85 DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin, 238 DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin,
86 mojo.common.mojom.String16 name); 239 mojo.common.mojom.String16 name);
87 }; 240 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698