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