OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Message definition file, included multiple times, hence no include guard. | 5 // Message definition file, included multiple times, hence no include guard. |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "content/common/indexed_db/indexed_db_key.h" | 13 #include "content/common/indexed_db/indexed_db_key.h" |
14 #include "content/common/indexed_db/indexed_db_key_path.h" | 14 #include "content/common/indexed_db/indexed_db_key_path.h" |
15 #include "content/common/indexed_db/indexed_db_key_range.h" | 15 #include "content/common/indexed_db/indexed_db_key_range.h" |
16 #include "content/common/indexed_db/indexed_db_param_traits.h" | 16 #include "content/common/indexed_db/indexed_db_param_traits.h" |
17 #include "ipc/ipc_message_macros.h" | 17 #include "ipc/ipc_message_macros.h" |
18 #include "ipc/ipc_message_utils.h" | |
18 #include "ipc/ipc_param_traits.h" | 19 #include "ipc/ipc_param_traits.h" |
19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 20 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
20 #include "url/origin.h" | 21 #include "url/origin.h" |
21 | 22 |
22 // Singly-included section for typedefs in multiply-included file. | 23 // Singly-included section for typedefs in multiply-included file. |
23 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ | 24 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ |
24 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ | 25 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ |
25 | 26 |
26 // An index id, and corresponding set of keys to insert. | 27 // An index id, and corresponding set of keys to insert. |
27 typedef std::pair<int64_t, std::vector<content::IndexedDBKey>> IndexKeys; | 28 typedef std::pair<int64_t, std::vector<content::IndexedDBKey>> IndexKeys; |
28 | 29 |
29 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ | 30 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ |
30 | 31 |
31 #undef IPC_MESSAGE_EXPORT | 32 #undef IPC_MESSAGE_EXPORT |
32 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 33 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
33 #define IPC_MESSAGE_START IndexedDBMsgStart | 34 #define IPC_MESSAGE_START IndexedDBMsgStart |
34 | 35 |
35 // Argument structures used in messages | 36 // Argument structures used in messages |
36 | 37 |
37 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBCursorDirection, | 38 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBCursorDirection, |
38 blink::WebIDBCursorDirectionLast) | 39 blink::WebIDBCursorDirectionLast) |
39 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBPutMode, blink::WebIDBPutModeLast) | 40 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBPutMode, blink::WebIDBPutModeLast) |
40 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTaskType, blink::WebIDBTaskTypeLast) | 41 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTaskType, blink::WebIDBTaskTypeLast) |
41 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTransactionMode, | 42 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTransactionMode, |
42 blink::WebIDBTransactionModeLast) | 43 blink::WebIDBTransactionModeLast) |
43 | 44 |
44 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBDataLoss, blink::WebIDBDataLossTotal) | 45 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBDataLoss, blink::WebIDBDataLossTotal) |
46 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBOperationType, | |
47 blink::WebIDBOperationTypeLast) | |
45 | 48 |
46 // Used to enumerate indexed databases. | 49 // Used to enumerate indexed databases. |
47 IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryGetDatabaseNames_Params) | 50 IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryGetDatabaseNames_Params) |
48 // The response should have these ids. | 51 // The response should have these ids. |
49 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) | 52 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) |
50 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) | 53 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) |
51 // The origin doing the initiating. | 54 // The origin doing the initiating. |
52 IPC_STRUCT_MEMBER(url::Origin, origin) | 55 IPC_STRUCT_MEMBER(url::Origin, origin) |
53 IPC_STRUCT_END() | 56 IPC_STRUCT_END() |
54 | 57 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 IPC_STRUCT_MEMBER(std::vector<IndexedDBMsg_BlobOrFileInfo>, blob_or_file_info) | 169 IPC_STRUCT_MEMBER(std::vector<IndexedDBMsg_BlobOrFileInfo>, blob_or_file_info) |
167 IPC_STRUCT_END() | 170 IPC_STRUCT_END() |
168 | 171 |
169 IPC_STRUCT_BEGIN_WITH_PARENT(IndexedDBMsg_ReturnValue, IndexedDBMsg_Value) | 172 IPC_STRUCT_BEGIN_WITH_PARENT(IndexedDBMsg_ReturnValue, IndexedDBMsg_Value) |
170 IPC_STRUCT_TRAITS_PARENT(IndexedDBMsg_Value) | 173 IPC_STRUCT_TRAITS_PARENT(IndexedDBMsg_Value) |
171 // Optional primary key & path used only when key generator specified. | 174 // Optional primary key & path used only when key generator specified. |
172 IPC_STRUCT_MEMBER(content::IndexedDBKey, primary_key) | 175 IPC_STRUCT_MEMBER(content::IndexedDBKey, primary_key) |
173 IPC_STRUCT_MEMBER(content::IndexedDBKeyPath, key_path) | 176 IPC_STRUCT_MEMBER(content::IndexedDBKeyPath, key_path) |
174 IPC_STRUCT_END() | 177 IPC_STRUCT_END() |
175 | 178 |
179 // WebIDBDatabase::observe() message. | |
180 IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseObserve_Params) | |
181 // The database the observer observers on. | |
182 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) | |
183 // The transaction it's associated with. | |
184 IPC_STRUCT_MEMBER(int32_t, transaction_id) | |
185 IPC_STRUCT_MEMBER(int32_t, observer_id) | |
186 IPC_STRUCT_MEMBER(bool, include_transaction) | |
187 IPC_STRUCT_MEMBER(bool, no_records) | |
188 IPC_STRUCT_MEMBER(bool, values) | |
189 IPC_STRUCT_END() | |
190 | |
176 // Used to set a value in an object store. | 191 // Used to set a value in an object store. |
177 IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabasePut_Params) | 192 IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabasePut_Params) |
178 // The id any response should contain. | 193 // The id any response should contain. |
179 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) | 194 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) |
180 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) | 195 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) |
181 // The database the object store belongs to. | 196 // The database the object store belongs to. |
182 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) | 197 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) |
183 // The transaction it's associated with. | 198 // The transaction it's associated with. |
184 IPC_STRUCT_MEMBER(int64_t, transaction_id) | 199 IPC_STRUCT_MEMBER(int64_t, transaction_id) |
185 // The object store's id. | 200 // The object store's id. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) | 366 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) |
352 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) | 367 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) |
353 IPC_STRUCT_MEMBER(int32_t, ipc_database_callbacks_id) | 368 IPC_STRUCT_MEMBER(int32_t, ipc_database_callbacks_id) |
354 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) | 369 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) |
355 IPC_STRUCT_MEMBER(int64_t, old_version) | 370 IPC_STRUCT_MEMBER(int64_t, old_version) |
356 IPC_STRUCT_MEMBER(blink::WebIDBDataLoss, data_loss) | 371 IPC_STRUCT_MEMBER(blink::WebIDBDataLoss, data_loss) |
357 IPC_STRUCT_MEMBER(std::string, data_loss_message) | 372 IPC_STRUCT_MEMBER(std::string, data_loss_message) |
358 IPC_STRUCT_MEMBER(IndexedDBDatabaseMetadata, idb_metadata) | 373 IPC_STRUCT_MEMBER(IndexedDBDatabaseMetadata, idb_metadata) |
359 IPC_STRUCT_END() | 374 IPC_STRUCT_END() |
360 | 375 |
376 IPC_STRUCT_BEGIN(IndexedDBMsg_Observation) | |
377 IPC_STRUCT_MEMBER(int64_t, object_store_id) | |
378 IPC_STRUCT_MEMBER(blink::WebIDBOperationType, type) | |
379 IPC_STRUCT_MEMBER(content::IndexedDBKeyRange, key_range) | |
380 IPC_STRUCT_END() | |
381 | |
382 // IPC_MESSAGE macros fail on the std::map, when expanding. We need to define | |
383 // a type to avoid that. | |
384 // Map observer_id to corresponding set of indices in observations. | |
385 using ObservationIndex = std::map<int32_t, std::vector<int32_t>>; | |
386 | |
387 IPC_STRUCT_BEGIN(IndexedDBMsg_ObserverChanges) | |
388 IPC_STRUCT_MEMBER(ObservationIndex, observation_index) | |
389 IPC_STRUCT_MEMBER(std::vector<IndexedDBMsg_Observation>, observations) | |
390 IPC_STRUCT_END() | |
391 | |
361 // Indexed DB messages sent from the browser to the renderer. | 392 // Indexed DB messages sent from the browser to the renderer. |
362 | 393 |
363 // The thread_id needs to be the first parameter in these messages. In the IO | 394 // The thread_id needs to be the first parameter in these messages. In the IO |
364 // thread on the renderer/client process, an IDB message filter assumes the | 395 // thread on the renderer/client process, an IDB message filter assumes the |
365 // thread_id is the first int. | 396 // thread_id is the first int. |
366 | 397 |
367 // IDBCallback message handlers. | 398 // IDBCallback message handlers. |
368 IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessIDBCursor, | 399 IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessIDBCursor, |
369 IndexedDBMsg_CallbacksSuccessIDBCursor_Params) | 400 IndexedDBMsg_CallbacksSuccessIDBCursor_Params) |
370 | 401 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 IPC_MESSAGE_CONTROL5(IndexedDBMsg_DatabaseCallbacksAbort, | 463 IPC_MESSAGE_CONTROL5(IndexedDBMsg_DatabaseCallbacksAbort, |
433 int32_t, /* ipc_thread_id */ | 464 int32_t, /* ipc_thread_id */ |
434 int32_t, /* ipc_database_callbacks_id */ | 465 int32_t, /* ipc_database_callbacks_id */ |
435 int64_t, /* transaction_id */ | 466 int64_t, /* transaction_id */ |
436 int, /* code */ | 467 int, /* code */ |
437 base::string16) /* message */ | 468 base::string16) /* message */ |
438 IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksComplete, | 469 IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksComplete, |
439 int32_t, /* ipc_thread_id */ | 470 int32_t, /* ipc_thread_id */ |
440 int32_t, /* ipc_database_callbacks_id */ | 471 int32_t, /* ipc_database_callbacks_id */ |
441 int64_t) /* transaction_id */ | 472 int64_t) /* transaction_id */ |
473 IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksChanges, | |
474 int32_t, /* ipc_thread_id */ | |
475 int32_t, /* ipc_database_id */ | |
476 IndexedDBMsg_ObserverChanges) | |
442 | 477 |
443 // Indexed DB messages sent from the renderer to the browser. | 478 // Indexed DB messages sent from the render to the browser. |
jsbell
2016/07/14 20:08:13
This should be "renderer"
palakj1
2016/07/15 20:16:04
Done.
| |
444 | 479 |
445 // WebIDBCursor::advance() message. | 480 // WebIDBCursor::advance() message. |
446 IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_CursorAdvance, | 481 IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_CursorAdvance, |
447 int32_t, /* ipc_cursor_id */ | 482 int32_t, /* ipc_cursor_id */ |
448 int32_t, /* ipc_thread_id */ | 483 int32_t, /* ipc_thread_id */ |
449 int32_t, /* ipc_callbacks_id */ | 484 int32_t, /* ipc_callbacks_id */ |
450 uint32_t) /* count */ | 485 uint32_t) /* count */ |
451 | 486 |
452 // WebIDBCursor::continue() message. | 487 // WebIDBCursor::continue() message. |
453 IPC_MESSAGE_CONTROL5(IndexedDBHostMsg_CursorContinue, | 488 IPC_MESSAGE_CONTROL5(IndexedDBHostMsg_CursorContinue, |
(...skipping 24 matching lines...) Expand all Loading... | |
478 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryOpen, | 513 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryOpen, |
479 IndexedDBHostMsg_FactoryOpen_Params) | 514 IndexedDBHostMsg_FactoryOpen_Params) |
480 | 515 |
481 // WebIDBFactory::deleteDatabase() message. | 516 // WebIDBFactory::deleteDatabase() message. |
482 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryDeleteDatabase, | 517 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryDeleteDatabase, |
483 IndexedDBHostMsg_FactoryDeleteDatabase_Params) | 518 IndexedDBHostMsg_FactoryDeleteDatabase_Params) |
484 | 519 |
485 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_AckReceivedBlobs, | 520 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_AckReceivedBlobs, |
486 std::vector<std::string>) /* uuids */ | 521 std::vector<std::string>) /* uuids */ |
487 | 522 |
488 // WebIDBDatabase::observe() message. | |
489 IPC_MESSAGE_CONTROL3(IndexedDBHostMsg_DatabaseObserve, | |
490 int32_t, /* ipc_database_id */ | |
491 int64_t, /* transaction_id */ | |
492 int32_t) /* observer_id */ | |
493 | |
494 // WebIDBDatabase::unobserve() message. | 523 // WebIDBDatabase::unobserve() message. |
495 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseUnobserve, | 524 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseUnobserve, |
496 int32_t, /* ipc_database_id */ | 525 int32_t, /* ipc_database_id */ |
497 std::vector<int32_t>) /* list of observer_id */ | 526 std::vector<int32_t>) /* list of observer_id */ |
498 | 527 |
499 // WebIDBDatabase::createObjectStore() message. | 528 // WebIDBDatabase::createObjectStore() message. |
500 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseCreateObjectStore, | 529 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseCreateObjectStore, |
501 IndexedDBHostMsg_DatabaseCreateObjectStore_Params) | 530 IndexedDBHostMsg_DatabaseCreateObjectStore_Params) |
502 | 531 |
503 // WebIDBDatabase::deleteObjectStore() message. | 532 // WebIDBDatabase::deleteObjectStore() message. |
(...skipping 19 matching lines...) Expand all Loading... | |
523 int32_t /* ipc_database_id */) | 552 int32_t /* ipc_database_id */) |
524 | 553 |
525 // WebIDBDatabase::get() message. | 554 // WebIDBDatabase::get() message. |
526 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseGet, | 555 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseGet, |
527 IndexedDBHostMsg_DatabaseGet_Params) | 556 IndexedDBHostMsg_DatabaseGet_Params) |
528 | 557 |
529 // WebIDBDatabase::getAll() message. | 558 // WebIDBDatabase::getAll() message. |
530 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseGetAll, | 559 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseGetAll, |
531 IndexedDBHostMsg_DatabaseGetAll_Params) | 560 IndexedDBHostMsg_DatabaseGetAll_Params) |
532 | 561 |
562 // WebIDBDatabase::observe() message. | |
563 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseObserve, | |
564 IndexedDBHostMsg_DatabaseObserve_Params) | |
565 | |
533 // WebIDBDatabase::put() message. | 566 // WebIDBDatabase::put() message. |
534 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabasePut, | 567 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabasePut, |
535 IndexedDBHostMsg_DatabasePut_Params) | 568 IndexedDBHostMsg_DatabasePut_Params) |
536 | 569 |
537 // WebIDBDatabase::setIndexKeys() message. | 570 // WebIDBDatabase::setIndexKeys() message. |
538 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseSetIndexKeys, | 571 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseSetIndexKeys, |
539 IndexedDBHostMsg_DatabaseSetIndexKeys_Params) | 572 IndexedDBHostMsg_DatabaseSetIndexKeys_Params) |
540 | 573 |
541 // WebIDBDatabase::setIndexesReady() message. | 574 // WebIDBDatabase::setIndexesReady() message. |
542 IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_DatabaseSetIndexesReady, | 575 IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_DatabaseSetIndexesReady, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 int64_t) /* transaction_id */ | 615 int64_t) /* transaction_id */ |
583 | 616 |
584 // WebIDBDatabase::commit() message. | 617 // WebIDBDatabase::commit() message. |
585 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseCommit, | 618 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseCommit, |
586 int32_t, /* ipc_database_id */ | 619 int32_t, /* ipc_database_id */ |
587 int64_t) /* transaction_id */ | 620 int64_t) /* transaction_id */ |
588 | 621 |
589 // WebIDBDatabase::~WebIDBCursor() message. | 622 // WebIDBDatabase::~WebIDBCursor() message. |
590 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, | 623 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, |
591 int32_t /* ipc_cursor_id */) | 624 int32_t /* ipc_cursor_id */) |
OLD | NEW |