| 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 "base/memory/ptr_util.h" |
| 13 #include "content/common/indexed_db/indexed_db_key.h" | 14 #include "content/common/indexed_db/indexed_db_key.h" |
| 14 #include "content/common/indexed_db/indexed_db_key_path.h" | 15 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 15 #include "content/common/indexed_db/indexed_db_key_range.h" | 16 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 17 #include "content/common/indexed_db/indexed_db_observation.h" |
| 16 #include "content/common/indexed_db/indexed_db_param_traits.h" | 18 #include "content/common/indexed_db/indexed_db_param_traits.h" |
| 17 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
| 20 #include "ipc/ipc_message_utils.h" |
| 18 #include "ipc/ipc_param_traits.h" | 21 #include "ipc/ipc_param_traits.h" |
| 19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 22 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 20 #include "url/origin.h" | 23 #include "url/origin.h" |
| 21 | 24 |
| 22 // Singly-included section for typedefs in multiply-included file. | 25 // Singly-included section for typedefs in multiply-included file. |
| 23 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ | 26 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ |
| 24 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ | 27 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ |
| 25 | 28 |
| 26 // An index id, and corresponding set of keys to insert. | 29 // An index id, and corresponding set of keys to insert. |
| 27 typedef std::pair<int64_t, std::vector<content::IndexedDBKey>> IndexKeys; | 30 typedef std::pair<int64_t, std::vector<content::IndexedDBKey>> IndexKeys; |
| 28 | 31 |
| 29 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ | 32 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_MESSAGES_H_ |
| 30 | 33 |
| 31 #undef IPC_MESSAGE_EXPORT | 34 #undef IPC_MESSAGE_EXPORT |
| 32 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 35 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 33 #define IPC_MESSAGE_START IndexedDBMsgStart | 36 #define IPC_MESSAGE_START IndexedDBMsgStart |
| 34 | 37 |
| 35 // Argument structures used in messages | 38 // Argument structures used in messages |
| 36 | 39 |
| 37 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBCursorDirection, | 40 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBCursorDirection, |
| 38 blink::WebIDBCursorDirectionLast) | 41 blink::WebIDBCursorDirectionLast) |
| 39 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBPutMode, blink::WebIDBPutModeLast) | 42 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBPutMode, blink::WebIDBPutModeLast) |
| 40 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTaskType, blink::WebIDBTaskTypeLast) | 43 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTaskType, blink::WebIDBTaskTypeLast) |
| 41 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTransactionMode, | 44 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBTransactionMode, |
| 42 blink::WebIDBTransactionModeLast) | 45 blink::WebIDBTransactionModeLast) |
| 43 | 46 |
| 44 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBDataLoss, blink::WebIDBDataLossTotal) | 47 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebIDBDataLoss, blink::WebIDBDataLossTotal) |
| 48 IPC_ENUM_TRAITS_MAX_VALUE(content::IndexedDBObservation::OperationType, |
| 49 content::IndexedDBObservation::CLEAR) |
| 45 | 50 |
| 46 // Used to enumerate indexed databases. | 51 // Used to enumerate indexed databases. |
| 47 IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryGetDatabaseNames_Params) | 52 IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryGetDatabaseNames_Params) |
| 48 // The response should have these ids. | 53 // The response should have these ids. |
| 49 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) | 54 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) |
| 50 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) | 55 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) |
| 51 // The origin doing the initiating. | 56 // The origin doing the initiating. |
| 52 IPC_STRUCT_MEMBER(url::Origin, origin) | 57 IPC_STRUCT_MEMBER(url::Origin, origin) |
| 53 IPC_STRUCT_END() | 58 IPC_STRUCT_END() |
| 54 | 59 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) | 356 IPC_STRUCT_MEMBER(int32_t, ipc_thread_id) |
| 352 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) | 357 IPC_STRUCT_MEMBER(int32_t, ipc_callbacks_id) |
| 353 IPC_STRUCT_MEMBER(int32_t, ipc_database_callbacks_id) | 358 IPC_STRUCT_MEMBER(int32_t, ipc_database_callbacks_id) |
| 354 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) | 359 IPC_STRUCT_MEMBER(int32_t, ipc_database_id) |
| 355 IPC_STRUCT_MEMBER(int64_t, old_version) | 360 IPC_STRUCT_MEMBER(int64_t, old_version) |
| 356 IPC_STRUCT_MEMBER(blink::WebIDBDataLoss, data_loss) | 361 IPC_STRUCT_MEMBER(blink::WebIDBDataLoss, data_loss) |
| 357 IPC_STRUCT_MEMBER(std::string, data_loss_message) | 362 IPC_STRUCT_MEMBER(std::string, data_loss_message) |
| 358 IPC_STRUCT_MEMBER(IndexedDBDatabaseMetadata, idb_metadata) | 363 IPC_STRUCT_MEMBER(IndexedDBDatabaseMetadata, idb_metadata) |
| 359 IPC_STRUCT_END() | 364 IPC_STRUCT_END() |
| 360 | 365 |
| 366 IPC_STRUCT_BEGIN(IndexedDBObservation) |
| 367 IPC_STRUCT_MEMBER(content::IndexedDBObservation::OperationType, type) |
| 368 IPC_STRUCT_MEMBER(content::IndexedDBKeyRange, key_range) |
| 369 IPC_STRUCT_END() |
| 370 |
| 371 // IPC_MESSAGE macros fail on the std::map, when expanding. We need to define |
| 372 // a type to avoid that. |
| 373 // map observer_id to corresponding set of indices in observations. |
| 374 using ObservationMap = std::map<int32_t, std::vector<int32_t>>; |
| 375 |
| 376 IPC_STRUCT_BEGIN(IndexedDBObserverChanges) |
| 377 IPC_STRUCT_MEMBER(ObservationMap, observation_index) |
| 378 IPC_STRUCT_MEMBER(std::vector<IndexedDBObservation>, observations) |
| 379 IPC_STRUCT_END() |
| 380 |
| 361 // Indexed DB messages sent from the browser to the renderer. | 381 // Indexed DB messages sent from the browser to the renderer. |
| 362 | 382 |
| 363 // The thread_id needs to be the first parameter in these messages. In the IO | 383 // 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 | 384 // thread on the renderer/client process, an IDB message filter assumes the |
| 365 // thread_id is the first int. | 385 // thread_id is the first int. |
| 366 | 386 |
| 367 // IDBCallback message handlers. | 387 // IDBCallback message handlers. |
| 368 IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessIDBCursor, | 388 IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessIDBCursor, |
| 369 IndexedDBMsg_CallbacksSuccessIDBCursor_Params) | 389 IndexedDBMsg_CallbacksSuccessIDBCursor_Params) |
| 370 | 390 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 IPC_MESSAGE_CONTROL5(IndexedDBMsg_DatabaseCallbacksAbort, | 452 IPC_MESSAGE_CONTROL5(IndexedDBMsg_DatabaseCallbacksAbort, |
| 433 int32_t, /* ipc_thread_id */ | 453 int32_t, /* ipc_thread_id */ |
| 434 int32_t, /* ipc_database_callbacks_id */ | 454 int32_t, /* ipc_database_callbacks_id */ |
| 435 int64_t, /* transaction_id */ | 455 int64_t, /* transaction_id */ |
| 436 int, /* code */ | 456 int, /* code */ |
| 437 base::string16) /* message */ | 457 base::string16) /* message */ |
| 438 IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksComplete, | 458 IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksComplete, |
| 439 int32_t, /* ipc_thread_id */ | 459 int32_t, /* ipc_thread_id */ |
| 440 int32_t, /* ipc_database_callbacks_id */ | 460 int32_t, /* ipc_database_callbacks_id */ |
| 441 int64_t) /* transaction_id */ | 461 int64_t) /* transaction_id */ |
| 442 | 462 IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksChanges, |
| 443 // Indexed DB messages sent from the renderer to the browser. | 463 int32_t, /* ipc_thread_id */ |
| 464 int32_t, /* ipc_database_callbacks_id */ |
| 465 IndexedDBObserverChanges) |
| 444 | 466 |
| 445 // WebIDBCursor::advance() message. | 467 // WebIDBCursor::advance() message. |
| 446 IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_CursorAdvance, | 468 IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_CursorAdvance, |
| 447 int32_t, /* ipc_cursor_id */ | 469 int32_t, /* ipc_cursor_id */ |
| 448 int32_t, /* ipc_thread_id */ | 470 int32_t, /* ipc_thread_id */ |
| 449 int32_t, /* ipc_callbacks_id */ | 471 int32_t, /* ipc_callbacks_id */ |
| 450 uint32_t) /* count */ | 472 uint32_t) /* count */ |
| 451 | 473 |
| 452 // WebIDBCursor::continue() message. | 474 // WebIDBCursor::continue() message. |
| 453 IPC_MESSAGE_CONTROL5(IndexedDBHostMsg_CursorContinue, | 475 IPC_MESSAGE_CONTROL5(IndexedDBHostMsg_CursorContinue, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 int64_t) /* transaction_id */ | 604 int64_t) /* transaction_id */ |
| 583 | 605 |
| 584 // WebIDBDatabase::commit() message. | 606 // WebIDBDatabase::commit() message. |
| 585 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseCommit, | 607 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseCommit, |
| 586 int32_t, /* ipc_database_id */ | 608 int32_t, /* ipc_database_id */ |
| 587 int64_t) /* transaction_id */ | 609 int64_t) /* transaction_id */ |
| 588 | 610 |
| 589 // WebIDBDatabase::~WebIDBCursor() message. | 611 // WebIDBDatabase::~WebIDBCursor() message. |
| 590 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, | 612 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, |
| 591 int32_t /* ipc_cursor_id */) | 613 int32_t /* ipc_cursor_id */) |
| OLD | NEW |