- add sources.
[platform/framework/web/crosswalk.git] / src / content / common / message_port_messages.h
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/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"
19
20 #undef IPC_MESSAGE_EXPORT
21 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
22 #define IPC_MESSAGE_START MessagePortMsgStart
23
24 // Singly-included section, not converted.
25 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
26 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
27
28 typedef std::pair<string16, std::vector<int> > QueuedMessage;
29
30 #endif  // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
31
32 //-----------------------------------------------------------------------------
33 // MessagePort messages
34 // These are messages sent from the browser to child processes.
35
36 // Sends a message to a message port.
37 IPC_MESSAGE_ROUTED3(MessagePortMsg_Message,
38                     string16 /* message */,
39                     std::vector<int> /* sent_message_port_ids */,
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(MessagePortHostMsg_PostMessage,
64                      int /* sender_message_port_id */,
65                      string16 /* message */,
66                      std::vector<int> /* sent_message_port_ids */)
67
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 */)
72
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 */)
78
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 */)