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

Side by Side Diff: chrome/common/indexed_db_messages.h

Issue 5680007: Make IndexedDBDispatcherHost be a message filter and move its messages into a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/indexed_db_messages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_INDEXED_DB_MESSAGES_H_
6 #define CHROME_COMMON_INDEXED_DB_MESSAGES_H_
7 #pragma once
8
9 #include "chrome/common/indexed_db_key.h"
10 #include "chrome/common/indexed_db_param_traits.h"
11 #include "chrome/common/serialized_script_value.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_param_traits.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h"
15
16 #define IPC_MESSAGE_START IndexedDBMsgStart
17
18 // Used to open an indexed database.
19 struct IndexedDBHostMsg_FactoryOpen_Params {
20 IndexedDBHostMsg_FactoryOpen_Params();
21 ~IndexedDBHostMsg_FactoryOpen_Params();
22
23 // The routing ID of the view initiating the open.
24 int32 routing_id;
25
26 // The response should have this id.
27 int32 response_id;
28
29 // The origin doing the initiating.
30 string16 origin;
31
32 // The name of the database.
33 string16 name;
34
35 // The maximum size of the database.
36 uint64 maximum_size;
37 };
38
39 // Used to create an object store.
40 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params {
41 IndexedDBHostMsg_DatabaseCreateObjectStore_Params();
42 ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params();
43
44 // The name of the object store.
45 string16 name;
46
47 // The keyPath of the object store.
48 NullableString16 key_path;
49
50 // Whether the object store created should have a key generator.
51 bool auto_increment;
52
53 // The transaction this is associated with.
54 int32 transaction_id;
55
56 // The database the object store belongs to.
57 int32 idb_database_id;
58 };
59
60 // Used to open both cursors and object cursors in IndexedDB.
61 struct IndexedDBHostMsg_IndexOpenCursor_Params {
62 IndexedDBHostMsg_IndexOpenCursor_Params();
63 ~IndexedDBHostMsg_IndexOpenCursor_Params();
64
65 // The response should have this id.
66 int32 response_id;
67
68 // The serialized lower key.
69 IndexedDBKey lower_key;
70
71 // The serialized upper key.
72 IndexedDBKey upper_key;
73
74 // Is the lower bound open?
75 bool lower_open;
76
77 // Is the upper bound open?
78 bool upper_open;
79
80 // The direction of this cursor.
81 int32 direction;
82
83 // The index the index belongs to.
84 int32 idb_index_id;
85
86 // The transaction this request belongs to.
87 int transaction_id;
88 };
89
90 // Used to set a value in an object store.
91 struct IndexedDBHostMsg_ObjectStorePut_Params {
92 IndexedDBHostMsg_ObjectStorePut_Params();
93 ~IndexedDBHostMsg_ObjectStorePut_Params();
94
95 // The object store's id.
96 int32 idb_object_store_id;
97
98 // The id any response should contain.
99 int32 response_id;
100
101 // The value to set.
102 SerializedScriptValue serialized_value;
103
104 // The key to set it on (may not be "valid"/set in some cases).
105 IndexedDBKey key;
106
107 // If it already exists, don't update (just return an error).
108 bool add_only;
109
110 // The transaction it's associated with.
111 int transaction_id;
112 };
113
114 // Used to create an index.
115 struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params {
116 IndexedDBHostMsg_ObjectStoreCreateIndex_Params();
117 ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params();
118
119 // The name of the index.
120 string16 name;
121
122 // The keyPath of the index.
123 NullableString16 key_path;
124
125 // Whether the index created has unique keys.
126 bool unique;
127
128 // The transaction this is associated with.
129 int32 transaction_id;
130
131 // The object store the index belongs to.
132 int32 idb_object_store_id;
133 };
134
135 // Used to open an IndexedDB cursor.
136 struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params {
137 IndexedDBHostMsg_ObjectStoreOpenCursor_Params();
138 ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params();
139
140 // The response should have this id.
141 int32 response_id;
142
143 // The serialized lower key.
144 IndexedDBKey lower_key;
145
146 // The serialized upper key.
147 IndexedDBKey upper_key;
148
149 // Is the lower bound open?
150 bool lower_open;
151
152 // Is the upper bound open?
153 bool upper_open;
154
155 // The direction of this cursor.
156 int32 direction;
157
158 // The object store the cursor belongs to.
159 int32 idb_object_store_id;
160
161 // The transaction this request belongs to.
162 int transaction_id;
163 };
164
165 namespace IPC {
166 template <>
167 struct ParamTraits<IndexedDBHostMsg_FactoryOpen_Params> {
168 typedef IndexedDBHostMsg_FactoryOpen_Params param_type;
169 static void Write(Message* m, const param_type& p);
170 static bool Read(const Message* m, void** iter, param_type* p);
171 static void Log(const param_type& p, std::string* l);
172 };
173
174 template <>
175 struct ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params> {
176 typedef IndexedDBHostMsg_DatabaseCreateObjectStore_Params param_type;
177 static void Write(Message* m, const param_type& p);
178 static bool Read(const Message* m, void** iter, param_type* p);
179 static void Log(const param_type& p, std::string* l);
180 };
181
182 template <>
183 struct ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params> {
184 typedef IndexedDBHostMsg_IndexOpenCursor_Params param_type;
185 static void Write(Message* m, const param_type& p);
186 static bool Read(const Message* m, void** iter, param_type* p);
187 static void Log(const param_type& p, std::string* l);
188 };
189
190 template <>
191 struct ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params> {
192 typedef IndexedDBHostMsg_ObjectStorePut_Params param_type;
193 static void Write(Message* m, const param_type& p);
194 static bool Read(const Message* m, void** iter, param_type* p);
195 static void Log(const param_type& p, std::string* l);
196 };
197
198 template <>
199 struct ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params> {
200 typedef IndexedDBHostMsg_ObjectStoreCreateIndex_Params param_type;
201 static void Write(Message* m, const param_type& p);
202 static bool Read(const Message* m, void** iter, param_type* p);
203 static void Log(const param_type& p, std::string* l);
204 };
205
206 template <>
207 struct ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params> {
208 typedef IndexedDBHostMsg_ObjectStoreOpenCursor_Params param_type;
209 static void Write(Message* m, const param_type& p);
210 static bool Read(const Message* m, void** iter, param_type* p);
211 static void Log(const param_type& p, std::string* l);
212 };
213
214 } // namespace IPC
215
216 // Indexed DB messages sent from the browser to the renderer.
217
218 // IDBCallback message handlers.
219 IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessNull,
220 int32 /* response_id */)
221 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor,
222 int32 /* response_id */,
223 int32 /* cursor_id */)
224 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase,
225 int32 /* response_id */,
226 int32 /* idb_database_id */)
227 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIndexedDBKey,
228 int32 /* response_id */,
229 IndexedDBKey /* indexed_db_key */)
230 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBIndex,
231 int32 /* response_id */,
232 int32 /* idb_index_id */)
233 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBObjectStore,
234 int32 /* response_id */,
235 int32 /* idb_object_store_id */)
236 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBTransaction,
237 int32 /* response_id */,
238 int32 /* idb_transaction_id */)
239 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessSerializedScriptValue,
240 int32 /* response_id */,
241 SerializedScriptValue /* serialized_script_value */)
242 IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksError,
243 int32 /* response_id */,
244 int /* code */,
245 string16 /* message */)
246
247 // IDBTransactionCallback message handlers.
248 IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksAbort,
249 int32 /* transaction_id */)
250 IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksComplete,
251 int32 /* transaction_id */)
252 IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksTimeout,
253 int32 /* transaction_id */)
254
255
256 // Indexed DB messages sent from the renderer to the browser.
257
258 // WebIDBCursor::direction() message.
259 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorDirection,
260 int32, /* idb_cursor_id */
261 int32 /* direction */)
262
263 // WebIDBCursor::key() message.
264 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorKey,
265 int32, /* idb_cursor_id */
266 IndexedDBKey /* key */)
267
268 // WebIDBCursor::value() message.
269 IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_CursorValue,
270 int32, /* idb_cursor_id */
271 SerializedScriptValue, /* script_value */
272 IndexedDBKey /* key */)
273
274 // WebIDBCursor::update() message.
275 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorUpdate,
276 int32, /* idb_cursor_id */
277 int32, /* response_id */
278 SerializedScriptValue, /* value */
279 WebKit::WebExceptionCode /* ec */)
280
281 // WebIDBCursor::continue() message.
282 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorContinue,
283 int32, /* idb_cursor_id */
284 int32, /* response_id */
285 IndexedDBKey, /* key */
286 WebKit::WebExceptionCode /* ec */)
287
288 // WebIDBCursor::remove() message.
289 IPC_SYNC_MESSAGE_CONTROL2_1(IndexedDBHostMsg_CursorDelete,
290 int32, /* idb_cursor_id */
291 int32, /* response_id */
292 WebKit::WebExceptionCode /* ec */)
293
294 // WebIDBFactory::open() message.
295 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryOpen,
296 IndexedDBHostMsg_FactoryOpen_Params)
297
298 // WebIDBDatabase::name() message.
299 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseName,
300 int32, /* idb_database_id */
301 string16 /* name */)
302
303 // WebIDBDatabase::version() message.
304 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseVersion,
305 int32, /* idb_database_id */
306 string16 /* version */)
307
308 // WebIDBDatabase::objectStoreNames() message.
309 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseObjectStoreNames,
310 int32, /* idb_database_id */
311 std::vector<string16> /* objectStoreNames */)
312
313 // WebIDBDatabase::createObjectStore() message.
314 IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_DatabaseCreateObjectStore,
315 IndexedDBHostMsg_DatabaseCreateObjectStore_Params,
316 int32, /* object_store_id */
317 WebKit::WebExceptionCode /* ec */)
318
319 // WebIDBDatabase::removeObjectStore() message.
320 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStore,
321 int32, /* idb_database_id */
322 string16, /* name */
323 int32, /* transaction_id */
324 WebKit::WebExceptionCode /* ec */)
325
326 // WebIDBDatabase::setVersion() message.
327 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseSetVersion,
328 int32, /* idb_database_id */
329 int32, /* response_id */
330 string16, /* version */
331 WebKit::WebExceptionCode /* ec */)
332
333 // WebIDBDatabase::transaction() message.
334 // TODO: make this message async. Have the renderer create a
335 // temporary ID and keep a map in the browser process of real
336 // IDs to temporary IDs. We can then update the transaction
337 // to its real ID asynchronously.
338 IPC_SYNC_MESSAGE_CONTROL4_2(IndexedDBHostMsg_DatabaseTransaction,
339 int32, /* idb_database_id */
340 std::vector<string16>, /* object_stores */
341 int32, /* mode */
342 int32, /* timeout */
343 int32, /* idb_transaction_id */
344 WebKit::WebExceptionCode /* ec */)
345
346 // WebIDBDatabase::~WebIDBDatabase() message.
347 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseDestroyed,
348 int32 /* idb_database_id */)
349
350 // WebIDBIndex::name() message.
351 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexName,
352 int32, /* idb_index_id */
353 string16 /* name */)
354
355 // WebIDBIndex::storeName() message.
356 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexStoreName,
357 int32, /* idb_index_id */
358 string16 /* store_name */)
359
360 // WebIDBIndex::keyPath() message.
361 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexKeyPath,
362 int32, /* idb_index_id */
363 NullableString16 /* key_path */)
364
365 // WebIDBIndex::unique() message.
366 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexUnique,
367 int32, /* idb_unique_id */
368 bool /* unique */)
369
370 // WebIDBIndex::openObjectCursor() message.
371 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenObjectCursor,
372 IndexedDBHostMsg_IndexOpenCursor_Params,
373 WebKit::WebExceptionCode /* ec */)
374
375 // WebIDBIndex::openKeyCursor() message.
376 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenKeyCursor,
377 IndexedDBHostMsg_IndexOpenCursor_Params,
378 WebKit::WebExceptionCode /* ec */)
379
380 // WebIDBIndex::getObject() message.
381 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetObject,
382 int32, /* idb_index_id */
383 int32, /* response_id */
384 IndexedDBKey, /* key */
385 int32, /* transaction_id */
386 WebKit::WebExceptionCode /* ec */)
387
388 // WebIDBIndex::getKey() message.
389 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetKey,
390 int32, /* idb_index_id */
391 int32, /* response_id */
392 IndexedDBKey, /* key */
393 int32, /* transaction_id */
394 WebKit::WebExceptionCode /* ec */)
395
396 // WebIDBIndex::~WebIDBIndex() message.
397 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_IndexDestroyed,
398 int32 /* idb_index_id */)
399
400 // WebIDBObjectStore::name() message.
401 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreName,
402 int32, /* idb_object_store_id */
403 string16 /* name */)
404
405 // WebIDBObjectStore::keyPath() message.
406 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreKeyPath,
407 int32, /* idb_object_store_id */
408 NullableString16 /* keyPath */)
409
410 // WebIDBObjectStore::indexNames() message.
411 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreIndexNames,
412 int32, /* idb_object_store_id */
413 std::vector<string16> /* index_names */)
414
415 // WebIDBObjectStore::get() message.
416 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreGet,
417 int32, /* idb_object_store_id */
418 int32, /* response_id */
419 IndexedDBKey, /* key */
420 int32, /* transaction_id */
421 WebKit::WebExceptionCode /* ec */)
422
423 // WebIDBObjectStore::put() message.
424 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStorePut,
425 IndexedDBHostMsg_ObjectStorePut_Params,
426 WebKit::WebExceptionCode /* ec */)
427
428 // WebIDBObjectStore::delete() message.
429 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreDelete,
430 int32, /* idb_object_store_id */
431 int32, /* response_id */
432 IndexedDBKey, /* key */
433 int32, /* transaction_id */
434 WebKit::WebExceptionCode /* ec */)
435
436 // WebIDBObjectStore::createIndex() message.
437 IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_ObjectStoreCreateIndex,
438 IndexedDBHostMsg_ObjectStoreCreateIndex_Params,
439 int32, /* index_id */
440 WebKit::WebExceptionCode /* ec */)
441
442 // WebIDBObjectStore::index() message.
443 IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_ObjectStoreIndex,
444 int32, /* idb_object_store_id */
445 string16, /* name */
446 int32, /* idb_index_id */
447 WebKit::WebExceptionCode /* ec */)
448
449 // WebIDBObjectStore::deleteIndex() message.
450 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreDeleteIndex,
451 int32, /* idb_object_store_id */
452 string16, /* name */
453 int32, /* transaction_id */
454 WebKit::WebExceptionCode /* ec */)
455
456 // WebIDBObjectStore::openCursor() message.
457 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreOpenCursor,
458 IndexedDBHostMsg_ObjectStoreOpenCursor_Params,
459 WebKit::WebExceptionCode /* ec */)
460
461 // WebIDBObjectStore::~WebIDBObjectStore() message.
462 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_ObjectStoreDestroyed,
463 int32 /* idb_object_store_id */)
464
465 // WebIDBDatabase::~WebIDBCursor() message.
466 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed,
467 int32 /* idb_cursor_id */)
468
469 // IDBTransaction::ObjectStore message.
470 IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_TransactionObjectStore,
471 int32, /* transaction_id */
472 string16, /* name */
473 int32, /* object_store_id */
474 WebKit::WebExceptionCode /* ec */)
475
476 // WebIDBTransaction::mode() message.
477 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_TransactionMode,
478 int32, /* idb_transaction_id */
479 int /* mode */)
480
481 // WebIDBTransaction::abort() message.
482 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionAbort,
483 int32 /* idb_transaction_id */)
484
485 // IDBTransaction::DidCompleteTaskEvents() message.
486 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents,
487 int32 /* idb_transaction_id */)
488
489 // WebIDBTransaction::~WebIDBTransaction() message.
490 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed,
491 int32 /* idb_transaction_id */)
492
493 #endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_
OLDNEW
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/indexed_db_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698