Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / common / message_port_messages.h
blobbe435be33482b9ad6861e28475f6a4b4759ece25
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.
5 // Defines messages between the browser and worker process, as well as between
6 // the renderer and worker process.
8 // Multiply-included message file, hence no include guard.
10 #include <string>
11 #include <utility>
12 #include <vector>
14 #include "base/basictypes.h"
15 #include "base/strings/string16.h"
16 #include "content/common/content_export.h"
17 #include "ipc/ipc_message_macros.h"
18 #include "ipc/ipc_message_utils.h"
20 #undef IPC_MESSAGE_EXPORT
21 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
22 #define IPC_MESSAGE_START MessagePortMsgStart
24 // Singly-included section, not converted.
25 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
26 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
28 typedef std::pair<base::string16, std::vector<int> > QueuedMessage;
30 #endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
32 //-----------------------------------------------------------------------------
33 // MessagePort messages
34 // These are messages sent from the browser to child processes.
36 // Sends a message to a message port.
37 IPC_MESSAGE_ROUTED3(MessagePortMsg_Message,
38 base::string16 /* message */,
39 std::vector<int> /* sent_message_port_ids */,
40 std::vector<int> /* new_routing_ids */)
42 // Tells the Message Port Channel object that there are no more in-flight
43 // messages arriving.
44 IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued)
46 //-----------------------------------------------------------------------------
47 // MessagePortHost messages
48 // These are messages sent from child processes to the browser.
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 */)
57 // Sent when a Message Port Channel object is destroyed.
58 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort,
59 int /* message_port_id */)
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(MessagePortHostMsg_PostMessage,
64 int /* sender_message_port_id */,
65 base::string16 /* message */,
66 std::vector<int> /* sent_message_port_ids */)
68 // Causes messages sent to the remote port to be delivered to this local port.
69 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle,
70 int /* local_message_port_id */,
71 int /* remote_message_port_id */)
73 // 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
75 // destination.
76 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages,
77 int /* message_port_id */)
79 // Sends the browser all the queued messages that arrived at this message port
80 // after it was sent in a postMessage call.
81 // 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.
83 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages,
84 int /* message_port_id */,
85 std::vector<QueuedMessage> /* queued_messages */)
87 // 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
89 // port was available yet this will cause the browser to release those messages.
90 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_ReleaseMessages,
91 int /* message_port_id */)