OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Multiply-included file, no traditional include guard. | 5 // Multiply-included file, no traditional include guard. |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ipc/ipc_message_macros.h" | 9 #include "ipc/ipc_message_macros.h" |
10 | 10 |
11 #define IPC_MESSAGE_START AwMessagePortMsgStart | 11 #define IPC_MESSAGE_START AwMessagePortMsgStart |
12 | 12 |
13 //----------------------------------------------------------------------------- | 13 //----------------------------------------------------------------------------- |
14 // MessagePort messages | 14 // MessagePort messages |
15 // These are messages sent from the browser to the renderer process. | 15 // These are messages sent from the browser to the renderer process. |
16 | 16 |
17 // Tells the renderer to convert the sent message from a WebSerializeScript | 17 // Normally the postmessages are exchanged between the renderers and the message |
18 // format to a base::ListValue. Due to the complexities of renderer/browser | 18 // itself is opaque to the browser process. The format of the message is a |
19 // relation, this can only be done in renderer for now. | 19 // WebSerializesScriptValue. A WebSerializedScriptValue is a blink structure |
20 IPC_MESSAGE_ROUTED3(AwMessagePortMsg_Message, | 20 // and can only be serialized/deserialized in renderer. |
mnaganov (inactive)
2015/01/27 13:30:17
You may mention that we couldn't have Blink or V8
sgurun-gerrit only
2015/01/29 03:06:08
Done.
| |
21 // For posting messages from Java (Webview) to JS, we pass the browser/renderer | |
22 // boundary an extra time and convert the messages to a type that browser can | |
23 // use. Since WebView is single-process this is not terribly expensive, but | |
mnaganov (inactive)
2015/01/27 13:30:17
I would argue with this statement. Using IPC takes
sgurun-gerrit only
2015/01/29 03:06:08
Acknowledged. I am planning to add some perf tests
| |
24 // if we can do the conversion at the browser, then we can drop this code. | |
25 | |
26 // Tells the renderer to convert the message from a WebSerializeScript | |
27 // format to a base::ListValue. This IPC is used for messages that are | |
28 // incoming to Android webview from JS. | |
29 IPC_MESSAGE_ROUTED3(AwMessagePortMsg_InMessage, | |
mnaganov (inactive)
2015/01/27 13:30:17
The terms "In" and "Out" doesn't clearly mark the
sgurun-gerrit only
2015/01/29 03:06:08
Done.
| |
21 int /* recipient message port id */, | 30 int /* recipient message port id */, |
22 base::string16 /* message */, | 31 base::string16 /* message */, |
23 std::vector<int> /* sent message port_ids */) | 32 std::vector<int> /* sent message port_ids */) |
33 | |
34 // Tells the renderer to convert the message from a String16 | |
35 // format to a WebSerializedScriptValue. This IPC is used for messages that | |
36 // are outgoing from Webview to JS. | |
37 // TODO(sgurun) when we start supporting other types, use a ListValue instead | |
38 // of string16 | |
39 IPC_MESSAGE_ROUTED3(AwMessagePortMsg_OutMessage, | |
40 int /* recipient message port id */, | |
41 base::string16 /* message */, | |
42 std::vector<int> /* sent message port_ids */) | |
24 | 43 |
25 //----------------------------------------------------------------------------- | 44 //----------------------------------------------------------------------------- |
26 // These are messages sent from the renderer to the browser process. | 45 // These are messages sent from the renderer to the browser process. |
27 | 46 |
28 // Response to AwMessagePortMessage_ConvertMessage | 47 // Response to AwMessagePortMessage_InMessage |
29 IPC_MESSAGE_ROUTED3(AwMessagePortHostMsg_ConvertedMessage, | 48 IPC_MESSAGE_ROUTED3(AwMessagePortHostMsg_ConvertedInMessage, |
30 int /* recipient message port id */, | 49 int /* recipient message port id */, |
31 base::ListValue /* converted message */, | 50 base::ListValue /* converted message */, |
32 std::vector<int> /* sent message port_ids */) | 51 std::vector<int> /* sent message port_ids */) |
52 | |
53 // Response to AwMessagePortMessage_OutMessage | |
54 IPC_MESSAGE_ROUTED3(AwMessagePortHostMsg_ConvertedOutMessage, | |
55 int /* recipient message port id */, | |
56 base::string16 /* converted message */, | |
57 std::vector<int> /* sent message port_ids */) | |
OLD | NEW |