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

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

Issue 2449953008: Port messages sent by WebIDBDatabaseImpl to Mojo. (Closed)
Patch Set: Address cmumford@ and jsbell@'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 BlobOrFileInfo {
69 bool is_file;
dcheng 2016/11/03 04:27:04 Perhaps this could have a union to separate the bl
Reilly Grant (use Gerrit) 2016/11/03 21:32:22 Since files are a subset of blobs I've made the fi
70 string uuid;
71 mojo.common.mojom.String16 mime_type;
72 uint64 size;
73 mojo.common.mojom.String16 file_path;
dcheng 2016/11/03 04:27:04 Does mojo.mojom.FilePath work?
Reilly Grant (use Gerrit) 2016/11/03 21:32:22 Done.
74 mojo.common.mojom.String16 file_name;
75 double last_modified;
dcheng 2016/11/03 04:27:04 Is it possible to use mojo.common.mojom.Time for t
Reilly Grant (use Gerrit) 2016/11/03 21:32:22 Done.
76 };
77
78 struct Value {
79 string bits;
80 array<BlobOrFileInfo> blob_or_file_info;
81 };
82
83 struct ReturnValue {
84 Value value;
85 Key primary_key;
86 KeyPath key_path;
87 };
88
45 // The Callbacks interface is used to return results for individual requests. 89 // The Callbacks interface is used to return results for individual requests.
46 // Some requests may return multiple results before completion, such as 90 // Some requests may return multiple results before completion, such as
47 // UpgradeNeeded before SuccessDatabase. 91 // UpgradeNeeded before SuccessDatabase.
48 // 92 //
49 // TODO(https://crbug.com/627484): Many of these could be replaced with 93 // TODO(https://crbug.com/627484): Many of these could be replaced with
50 // replies associated with particular messages. 94 // replies associated with particular messages.
51 interface Callbacks { 95 interface Callbacks {
52 Error(int32 code, mojo.common.mojom.String16 message); 96 Error(int32 code, mojo.common.mojom.String16 message);
53 97
54 // Factory::GetDatabaseNames 98 // Factory::GetDatabaseNames
55 SuccessStringList(array<mojo.common.mojom.String16> value); 99 SuccessStringList(array<mojo.common.mojom.String16> value);
56 100
57 // Factory::Open / DeleteDatabase 101 // Factory::Open / DeleteDatabase
58 Blocked(int64 existing_version); 102 Blocked(int64 existing_version);
59 103
60 // Factory::Open 104 // Factory::Open
61 UpgradeNeeded(int32 database_id, int64 old_version, DataLoss data_loss, 105 UpgradeNeeded(associated Database database, int64 old_version,
62 string data_loss_message, DatabaseMetadata db_metadata); 106 DataLoss data_loss, string data_loss_message,
63 SuccessDatabase(int32 database_id, DatabaseMetadata metadata); 107 DatabaseMetadata db_metadata);
108 SuccessDatabase(associated Database? database, DatabaseMetadata metadata);
64 109
110 // Database::OpenCursor
111 SuccessCursor(int32 cursor_id, Key key, Key primary_key, Value? value);
112
113 // Database::Get / Cursor::Advance
114 SuccessValue(ReturnValue? value);
115
116 // Database::GetAll
117 SuccessArray(array<ReturnValue> values);
118
119 // Database::Put / Cursor::Update
120 SuccessKey(Key key);
121
122 // Database::Count / DeleteRange
65 // Factory::DeleteDatabase 123 // Factory::DeleteDatabase
66 SuccessInteger(int64 value); 124 SuccessInteger(int64 value);
125
126 // Cursor::Continue / Advance
127 Success();
67 }; 128 };
68 129
69 // The DatabaseCallbacks interface is used to notification of events out of 130 // 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 131 // band to individual requests. A single instance is used for the lifetime of
71 // a database connection. 132 // a database connection.
72 interface DatabaseCallbacks { 133 interface DatabaseCallbacks {
73 ForcedClose(); 134 ForcedClose();
74 VersionChange(int64 old_version, int64 new_version); 135 VersionChange(int64 old_version, int64 new_version);
75 Abort(int64 transaction_id, int32 code, 136 Abort(int64 transaction_id, int32 code,
76 mojo.common.mojom.String16 message); 137 mojo.common.mojom.String16 message);
77 Complete(int64 transaction_id); 138 Complete(int64 transaction_id);
78 }; 139 };
79 140
141 interface Database {
142 CreateObjectStore(int64 transaction_id,
143 int64 object_store_id,
144 mojo.common.mojom.String16 name,
145 KeyPath key_path,
146 bool auto_increment);
147 DeleteObjectStore(int64 transaction_id,
148 int64 object_store_id);
149 RenameObjectStore(int64 transaction_id,
150 int64 object_store_id,
151 mojo.common.mojom.String16 new_name);
152 CreateTransaction(int64 transaction_id,
153 array<int64> object_store_ids,
154 TransactionMode mode);
155 Close();
156 VersionChangeIgnored();
157 AddObserver(int64 transaction_id,
158 int32 observer_id,
159 bool include_transaction,
160 bool no_records,
161 bool values,
162 uint16 operation_types);
163 RemoveObservers(array<int32> observers);
164 Get(int64 transaction_id,
165 int64 object_store_id,
166 int64 index_id,
167 KeyRange key_range,
168 bool key_only,
169 associated Callbacks callbacks);
170 GetAll(int64 transaction_id,
171 int64 object_store_id,
172 int64 index_id,
173 KeyRange key_range,
174 bool key_only,
175 int64 max_count,
176 associated Callbacks callbacks);
177 Put(int64 transaction_id,
178 int64 object_store_id,
179 Value value,
180 Key key,
181 PutMode mode,
182 array<IndexKeys> index_keys,
183 associated Callbacks callbacks);
184 SetIndexKeys(int64 transaction_id,
185 int64 object_store_id,
186 Key primary_key,
187 array<IndexKeys> index_keys);
188 SetIndexesReady(int64 transaction_id,
189 int64 object_store_id,
190 array<int64> index_ids);
191 OpenCursor(int64 transaction_id,
192 int64 object_store_id,
193 int64 index_id,
194 KeyRange key_range,
195 CursorDirection direction,
196 bool key_only,
197 TaskType task_type,
198 associated Callbacks callbacks);
199 Count(int64 transaction_id,
200 int64 object_store_id,
201 int64 index_id,
202 KeyRange key_range,
203 associated Callbacks callbacks);
204 DeleteRange(int64 transaction_id,
205 int64 object_store_id,
206 KeyRange key_range,
207 associated Callbacks callbacks);
208 Clear(int64 transaction_id,
209 int64 object_store_id,
210 associated Callbacks callbacks);
211 CreateIndex(int64 transaction_id,
212 int64 object_store_id,
213 int64 index_id,
214 mojo.common.mojom.String16 name,
215 KeyPath key_path,
216 bool unique,
217 bool multi_entry);
218 DeleteIndex(int64 transaction_id,
219 int64 object_store_id,
220 int64 index_id);
221 RenameIndex(int64 transaction_id,
222 int64 object_store_id,
223 int64 index_id,
224 mojo.common.mojom.String16 new_name);
225 Abort(int64 transaction_id);
226 Commit(int64 transaction_id);
227 AckReceivedBlobs(array<string> uuids);
228 };
229
80 interface Factory { 230 interface Factory {
81 GetDatabaseNames(associated Callbacks callbacks, url.mojom.Origin origin); 231 GetDatabaseNames(associated Callbacks callbacks, url.mojom.Origin origin);
82 Open(int32 worker_thread, associated Callbacks callbacks, 232 Open(int32 worker_thread, associated Callbacks callbacks,
83 associated DatabaseCallbacks database_callbacks, url.mojom.Origin origin, 233 associated DatabaseCallbacks database_callbacks, url.mojom.Origin origin,
84 mojo.common.mojom.String16 name, int64 version, int64 transaction_id); 234 mojo.common.mojom.String16 name, int64 version, int64 transaction_id);
85 DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin, 235 DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin,
86 mojo.common.mojom.String16 name); 236 mojo.common.mojom.String16 name);
87 }; 237 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698