| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Defines messages between the browser and worker process, as well as between | 5 // Defines messages between the browser and worker process, as well as between |
| 6 // the renderer and worker process. | 6 // the renderer and worker process. |
| 7 | 7 |
| 8 // Multiply-included message file, hence no include guard. | 8 // Multiply-included message file, hence no include guard. |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/common/message_port_types.h" |
| 17 #include "ipc/ipc_message_macros.h" | 18 #include "ipc/ipc_message_macros.h" |
| 18 #include "ipc/ipc_message_utils.h" | 19 #include "ipc/ipc_message_utils.h" |
| 19 | 20 |
| 20 #undef IPC_MESSAGE_EXPORT | 21 #undef IPC_MESSAGE_EXPORT |
| 21 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 22 #define IPC_MESSAGE_START MessagePortMsgStart | 23 #define IPC_MESSAGE_START MessagePortMsgStart |
| 23 | 24 |
| 24 // Singly-included section, not converted. | 25 // Singly-included section for typedefs. |
| 25 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ | 26 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ |
| 26 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ | 27 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ |
| 27 | 28 |
| 28 typedef std::pair<base::string16, std::vector<int> > QueuedMessage; | 29 typedef std::pair<content::MessagePortMessage, std::vector<int>> QueuedMessage; |
| 29 | 30 |
| 30 #endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ | 31 #endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ |
| 31 | 32 |
| 33 IPC_STRUCT_TRAITS_BEGIN(content::MessagePortMessage) |
| 34 IPC_STRUCT_TRAITS_MEMBER(message_as_string) |
| 35 IPC_STRUCT_TRAITS_MEMBER(message_as_value) |
| 36 IPC_STRUCT_TRAITS_END() |
| 37 |
| 32 //----------------------------------------------------------------------------- | 38 //----------------------------------------------------------------------------- |
| 33 // MessagePort messages | 39 // MessagePort messages |
| 34 // These are messages sent from the browser to child processes. | 40 // These are messages sent from the browser to child processes. |
| 35 | 41 |
| 36 // Sends a message to a message port. | 42 // Sends a message to a message port. |
| 37 IPC_MESSAGE_ROUTED3(MessagePortMsg_Message, | 43 IPC_MESSAGE_ROUTED3(MessagePortMsg_Message, |
| 38 base::string16 /* message */, | 44 content::MessagePortMessage /* message */, |
| 39 std::vector<int> /* sent_message_port_ids */, | 45 std::vector<int> /* sent_message_port_ids */, |
| 40 std::vector<int> /* new_routing_ids */) | 46 std::vector<int> /* new_routing_ids */) |
| 41 | 47 |
| 42 // Tells the Message Port Channel object that there are no more in-flight | 48 // Tells the Message Port Channel object that there are no more in-flight |
| 43 // messages arriving. | 49 // messages arriving. |
| 44 IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued) | 50 IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued) |
| 45 | 51 |
| 46 //----------------------------------------------------------------------------- | 52 //----------------------------------------------------------------------------- |
| 47 // MessagePortHost messages | 53 // MessagePortHost messages |
| 48 // These are messages sent from child processes to the browser. | 54 // These are messages sent from child processes to the browser. |
| 49 | 55 |
| 50 // Creates a new Message Port Channel object. The first paramaeter is the | 56 // Creates a new Message Port Channel object. The first paramaeter is the |
| 51 // message port channel's routing id in this process. The second parameter | 57 // message port channel's routing id in this process. The second parameter |
| 52 // is the process-wide-unique identifier for that port. | 58 // is the process-wide-unique identifier for that port. |
| 53 IPC_SYNC_MESSAGE_CONTROL0_2(MessagePortHostMsg_CreateMessagePort, | 59 IPC_SYNC_MESSAGE_CONTROL0_2(MessagePortHostMsg_CreateMessagePort, |
| 54 int /* route_id */, | 60 int /* route_id */, |
| 55 int /* message_port_id */) | 61 int /* message_port_id */) |
| 56 | 62 |
| 57 // Sent when a Message Port Channel object is destroyed. | 63 // Sent when a Message Port Channel object is destroyed. |
| 58 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort, | 64 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort, |
| 59 int /* message_port_id */) | 65 int /* message_port_id */) |
| 60 | 66 |
| 61 // Sends a message to a message port. Optionally sends a message port as | 67 // Sends a message to a message port. Optionally sends a message port as |
| 62 // as well if sent_message_port_id != MSG_ROUTING_NONE. | 68 // as well if sent_message_port_id != MSG_ROUTING_NONE. |
| 63 IPC_MESSAGE_CONTROL3(MessagePortHostMsg_PostMessage, | 69 IPC_MESSAGE_CONTROL3(MessagePortHostMsg_PostMessage, |
| 64 int /* sender_message_port_id */, | 70 int /* sender_message_port_id */, |
| 65 base::string16 /* message */, | 71 content::MessagePortMessage /* message */, |
| 66 std::vector<int> /* sent_message_port_ids */) | 72 std::vector<int> /* sent_message_port_ids */) |
| 67 | 73 |
| 68 // Causes messages sent to the remote port to be delivered to this local port. | 74 // Causes messages sent to the remote port to be delivered to this local port. |
| 69 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle, | 75 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle, |
| 70 int /* local_message_port_id */, | 76 int /* local_message_port_id */, |
| 71 int /* remote_message_port_id */) | 77 int /* remote_message_port_id */) |
| 72 | 78 |
| 73 // Causes the browser to queue messages sent to this port until the the port | 79 // Causes the browser to queue messages sent to this port until the the port |
| 74 // has made sure that all in-flight messages were routed to the new | 80 // has made sure that all in-flight messages were routed to the new |
| 75 // destination. | 81 // destination. |
| 76 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages, | 82 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages, |
| 77 int /* message_port_id */) | 83 int /* message_port_id */) |
| 78 | 84 |
| 79 // Sends the browser all the queued messages that arrived at this message port | 85 // Sends the browser all the queued messages that arrived at this message port |
| 80 // after it was sent in a postMessage call. | 86 // after it was sent in a postMessage call. |
| 81 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> > | 87 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> > |
| 82 // is used, so we typedef it in worker_messages.h. | 88 // is used, so we typedef it in worker_messages.h. |
| 83 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages, | 89 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages, |
| 84 int /* message_port_id */, | 90 int /* message_port_id */, |
| 85 std::vector<QueuedMessage> /* queued_messages */) | 91 std::vector<QueuedMessage> /* queued_messages */) |
| 86 | 92 |
| 87 // Tells the browser this message port is ready to receive messages. If the | 93 // Tells the browser this message port is ready to receive messages. If the |
| 88 // browser was holding messages to this port because no destination for the | 94 // browser was holding messages to this port because no destination for the |
| 89 // port was available yet this will cause the browser to release those messages. | 95 // port was available yet this will cause the browser to release those messages. |
| 90 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_ReleaseMessages, | 96 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_ReleaseMessages, |
| 91 int /* message_port_id */) | 97 int /* message_port_id */) |
| OLD | NEW |