Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: content/common/message_port_messages.h

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/public/common/message_port_types.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
20 20
21 #undef IPC_MESSAGE_EXPORT 21 #undef IPC_MESSAGE_EXPORT
22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
23 #define IPC_MESSAGE_START MessagePortMsgStart 23 #define IPC_MESSAGE_START MessagePortMsgStart
24 24
25 // Singly-included section for typedefs. 25 // Singly-included section for typedefs.
26 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ 26 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
27 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ 27 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
28 28
29 typedef std::pair<content::MessagePortMessage, std::vector<int>> QueuedMessage; 29 typedef std::pair<content::MessagePortMessage,
30 std::vector<content::TransferredMessagePort>> QueuedMessage;
30 31
31 #endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ 32 #endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
32 33
33 IPC_STRUCT_TRAITS_BEGIN(content::MessagePortMessage) 34 IPC_STRUCT_TRAITS_BEGIN(content::MessagePortMessage)
34 IPC_STRUCT_TRAITS_MEMBER(message_as_string) 35 IPC_STRUCT_TRAITS_MEMBER(message_as_string)
35 IPC_STRUCT_TRAITS_MEMBER(message_as_value) 36 IPC_STRUCT_TRAITS_MEMBER(message_as_value)
36 IPC_STRUCT_TRAITS_END() 37 IPC_STRUCT_TRAITS_END()
37 38
39 IPC_STRUCT_TRAITS_BEGIN(content::TransferredMessagePort)
40 IPC_STRUCT_TRAITS_MEMBER(id)
41 IPC_STRUCT_TRAITS_MEMBER(send_messages_as_values)
42 IPC_STRUCT_TRAITS_END()
43
38 //----------------------------------------------------------------------------- 44 //-----------------------------------------------------------------------------
39 // MessagePort messages 45 // MessagePort messages
40 // These are messages sent from the browser to child processes. 46 // These are messages sent from the browser to child processes.
41 47
42 // Sends a message to a message port. 48 // Sends a message to a message port.
43 IPC_MESSAGE_ROUTED3(MessagePortMsg_Message, 49 IPC_MESSAGE_ROUTED3(
44 content::MessagePortMessage /* message */, 50 MessagePortMsg_Message,
45 std::vector<int> /* sent_message_port_ids */, 51 content::MessagePortMessage /* message */,
46 std::vector<int> /* new_routing_ids */) 52 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
53 std::vector<int> /* new_routing_ids */)
47 54
48 // Tells the Message Port Channel object that there are no more in-flight 55 // Tells the Message Port Channel object that there are no more in-flight
49 // messages arriving. 56 // messages arriving.
50 IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued) 57 IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued)
51 58
52 //----------------------------------------------------------------------------- 59 //-----------------------------------------------------------------------------
53 // MessagePortHost messages 60 // MessagePortHost messages
54 // These are messages sent from child processes to the browser. 61 // These are messages sent from child processes to the browser.
55 62
56 // Creates a new Message Port Channel object. The first paramaeter is the 63 // Creates a new Message Port Channel object. The first paramaeter is the
57 // message port channel's routing id in this process. The second parameter 64 // message port channel's routing id in this process. The second parameter
58 // is the process-wide-unique identifier for that port. 65 // is the process-wide-unique identifier for that port.
59 IPC_SYNC_MESSAGE_CONTROL0_2(MessagePortHostMsg_CreateMessagePort, 66 IPC_SYNC_MESSAGE_CONTROL0_2(MessagePortHostMsg_CreateMessagePort,
60 int /* route_id */, 67 int /* route_id */,
61 int /* message_port_id */) 68 int /* message_port_id */)
62 69
63 // Sent when a Message Port Channel object is destroyed. 70 // Sent when a Message Port Channel object is destroyed.
64 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort, 71 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort,
65 int /* message_port_id */) 72 int /* message_port_id */)
66 73
67 // Sends a message to a message port. Optionally sends a message port as 74 // Sends a message to a message port. Optionally sends a message port as
68 // as well if sent_message_port_id != MSG_ROUTING_NONE. 75 // as well if sent_message_port_id != MSG_ROUTING_NONE.
69 IPC_MESSAGE_CONTROL3(MessagePortHostMsg_PostMessage, 76 IPC_MESSAGE_CONTROL3(
70 int /* sender_message_port_id */, 77 MessagePortHostMsg_PostMessage,
71 content::MessagePortMessage /* message */, 78 int /* sender_message_port_id */,
72 std::vector<int> /* sent_message_port_ids */) 79 content::MessagePortMessage /* message */,
80 std::vector<content::TransferredMessagePort> /* sent_message_ports */)
73 81
74 // Causes messages sent to the remote port to be delivered to this local port. 82 // Causes messages sent to the remote port to be delivered to this local port.
75 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle, 83 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle,
76 int /* local_message_port_id */, 84 int /* local_message_port_id */,
77 int /* remote_message_port_id */) 85 int /* remote_message_port_id */)
78 86
79 // Causes the browser to queue messages sent to this port until the the port 87 // Causes the browser to queue messages sent to this port until the the port
80 // has made sure that all in-flight messages were routed to the new 88 // has made sure that all in-flight messages were routed to the new
81 // destination. 89 // destination.
82 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages, 90 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages,
83 int /* message_port_id */) 91 int /* message_port_id */)
84 92
85 // Sends the browser all the queued messages that arrived at this message port 93 // Sends the browser all the queued messages that arrived at this message port
86 // after it was sent in a postMessage call. 94 // after it was sent in a postMessage call.
87 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> > 95 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> >
88 // is used, so we typedef it in worker_messages.h. 96 // is used, so we typedef it in worker_messages.h.
89 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages, 97 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages,
90 int /* message_port_id */, 98 int /* message_port_id */,
91 std::vector<QueuedMessage> /* queued_messages */) 99 std::vector<QueuedMessage> /* queued_messages */)
92 100
93 // Tells the browser this message port is ready to receive messages. If the 101 // Tells the browser this message port is ready to receive messages. If the
94 // browser was holding messages to this port because no destination for the 102 // browser was holding messages to this port because no destination for the
95 // port was available yet this will cause the browser to release those messages. 103 // port was available yet this will cause the browser to release those messages.
96 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_ReleaseMessages, 104 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_ReleaseMessages,
97 int /* message_port_id */) 105 int /* message_port_id */)
OLDNEW
« no previous file with comments | « content/child/webmessageportchannel_impl.cc ('k') | content/common/navigator_connect_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698