| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <utility> | 5 #include <utility> |
| 6 #include <vector> | 6 #include <vector> |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "ipc/ipc_message_macros.h" | 9 #include "ipc/ipc_message_macros.h" |
| 10 | 10 |
| 11 #define IPC_MESSAGE_START WorkerMsgStart |
| 11 | 12 |
| 12 //----------------------------------------------------------------------------- | 13 //----------------------------------------------------------------------------- |
| 13 // WorkerProcess messages | 14 // WorkerProcess messages |
| 14 // These are messages sent from the browser to the worker process. | 15 // These are messages sent from the browser to the worker process. |
| 15 IPC_BEGIN_MESSAGES(WorkerProcess) | 16 IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker, |
| 16 IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker, | 17 WorkerProcessMsg_CreateWorker_Params) |
| 17 WorkerProcessMsg_CreateWorker_Params) | |
| 18 | 18 |
| 19 // Note: these Message Port related messages can also be sent to the | 19 // Note: these Message Port related messages can also be sent to the |
| 20 // renderer process. Putting them here since we don't have a shared place | 20 // renderer process. Putting them here since we don't have a shared place |
| 21 // like common_messages_internal.h | 21 // like common_messages_internal.h |
| 22 IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message, | 22 IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message, |
| 23 string16 /* message */, | 23 string16 /* message */, |
| 24 std::vector<int> /* sent_message_port_ids */, | 24 std::vector<int> /* sent_message_port_ids */, |
| 25 std::vector<int> /* new_routing_ids */) | 25 std::vector<int> /* new_routing_ids */) |
| 26 | 26 |
| 27 // Tells the Message Port Channel object that there are no more in-flight | 27 // Tells the Message Port Channel object that there are no more in-flight |
| 28 // messages arriving. | 28 // messages arriving. |
| 29 IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued) | 29 IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued) |
| 30 IPC_END_MESSAGES(WorkerProcess) | |
| 31 | 30 |
| 32 | 31 |
| 33 //----------------------------------------------------------------------------- | 32 //----------------------------------------------------------------------------- |
| 34 // WorkerProcessHost messages | 33 // WorkerProcessHost messages |
| 35 // These are messages sent from the worker process to the browser process. | 34 // These are messages sent from the worker process to the browser process. |
| 36 | 35 |
| 37 IPC_BEGIN_MESSAGES(WorkerProcessHost) | 36 // Note: these Message Port related messages can also be sent out from the |
| 38 // Note: these Message Port related messages can also be sent out from the | 37 // renderer process. Putting them here since we don't have a shared place |
| 39 // renderer process. Putting them here since we don't have a shared place | 38 // like common_messages_internal.h |
| 40 // like common_messages_internal.h | |
| 41 | 39 |
| 42 // Creates a new Message Port Channel object. The first paramaeter is the | 40 // Creates a new Message Port Channel object. The first paramaeter is the |
| 43 // message port channel's routing id in this process. The second parameter | 41 // message port channel's routing id in this process. The second parameter |
| 44 // is the process-wide-unique identifier for that port. | 42 // is the process-wide-unique identifier for that port. |
| 45 IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort, | 43 IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort, |
| 46 int /* route_id */, | 44 int /* route_id */, |
| 47 int /* message_port_id */) | 45 int /* message_port_id */) |
| 48 | 46 |
| 49 // Sent when a Message Port Channel object is destroyed. | 47 // Sent when a Message Port Channel object is destroyed. |
| 50 IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort, | 48 IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort, |
| 51 int /* message_port_id */) | 49 int /* message_port_id */) |
| 52 | 50 |
| 53 // Sends a message to a message port. Optionally sends a message port as | 51 // Sends a message to a message port. Optionally sends a message port as |
| 54 // as well if sent_message_port_id != MSG_ROUTING_NONE. | 52 // as well if sent_message_port_id != MSG_ROUTING_NONE. |
| 55 IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage, | 53 IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage, |
| 56 int /* sender_message_port_id */, | 54 int /* sender_message_port_id */, |
| 57 string16 /* message */, | 55 string16 /* message */, |
| 58 std::vector<int> /* sent_message_port_ids */) | 56 std::vector<int> /* sent_message_port_ids */) |
| 59 | 57 |
| 60 // Causes messages sent to the remote port to be delivered to this local port. | 58 // Causes messages sent to the remote port to be delivered to this local port. |
| 61 IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle, | 59 IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle, |
| 62 int /* local_message_port_id */, | 60 int /* local_message_port_id */, |
| 63 int /* remote_message_port_id */) | 61 int /* remote_message_port_id */) |
| 64 | 62 |
| 65 // Causes the browser to queue messages sent to this port until the the port | 63 // Causes the browser to queue messages sent to this port until the the port |
| 66 // has made sure that all in-flight messages were routed to the new | 64 // has made sure that all in-flight messages were routed to the new |
| 67 // destination. | 65 // destination. |
| 68 IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages, | 66 IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages, |
| 69 int /* message_port_id */) | 67 int /* message_port_id */) |
| 70 | 68 |
| 71 // Sends the browser all the queued messages that arrived at this message port | 69 // Sends the browser all the queued messages that arrived at this message port |
| 72 // after it was sent in a postMessage call. | 70 // after it was sent in a postMessage call. |
| 73 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int>
> | 71 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> > |
| 74 // is used, so we typedef it in worker_messages.h. | 72 // is used, so we typedef it in worker_messages.h. |
| 75 IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages, | 73 IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages, |
| 76 int /* message_port_id */, | 74 int /* message_port_id */, |
| 77 std::vector<QueuedMessage> /* queued_messages */) | 75 std::vector<QueuedMessage> /* queued_messages */) |
| 78 | 76 |
| 79 // Sent by the worker process to check whether access to web databases is | 77 // Sent by the worker process to check whether access to web databases is |
| 80 // granted by content settings. | 78 // granted by content settings. |
| 81 IPC_SYNC_MESSAGE_ROUTED4_1(WorkerProcessHostMsg_AllowDatabase, | 79 IPC_SYNC_MESSAGE_ROUTED4_1(WorkerProcessHostMsg_AllowDatabase, |
| 82 GURL /* origin url */, | 80 GURL /* origin url */, |
| 83 string16 /* database name */, | 81 string16 /* database name */, |
| 84 string16 /* database display name */, | 82 string16 /* database display name */, |
| 85 unsigned long /* estimated size */, | 83 unsigned long /* estimated size */, |
| 86 bool /* result */) | 84 bool /* result */) |
| 87 IPC_END_MESSAGES(WorkerProcessHost) | |
| 88 | 85 |
| 89 //----------------------------------------------------------------------------- | 86 //----------------------------------------------------------------------------- |
| 90 // Worker messages | 87 // Worker messages |
| 91 // These are messages sent from the renderer process to the worker process. | 88 // These are messages sent from the renderer process to the worker process. |
| 92 IPC_BEGIN_MESSAGES(Worker) | 89 IPC_MESSAGE_ROUTED3(WorkerMsg_StartWorkerContext, |
| 93 IPC_MESSAGE_ROUTED3(WorkerMsg_StartWorkerContext, | 90 GURL /* url */, |
| 94 GURL /* url */, | 91 string16 /* user_agent */, |
| 95 string16 /* user_agent */, | 92 string16 /* source_code */) |
| 96 string16 /* source_code */) | |
| 97 | 93 |
| 98 IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext) | 94 IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext) |
| 99 | 95 |
| 100 IPC_MESSAGE_ROUTED3(WorkerMsg_PostMessage, | 96 IPC_MESSAGE_ROUTED3(WorkerMsg_PostMessage, |
| 101 string16 /* message */, | 97 string16 /* message */, |
| 102 std::vector<int> /* sent_message_port_ids */, | 98 std::vector<int> /* sent_message_port_ids */, |
| 103 std::vector<int> /* new_routing_ids */) | 99 std::vector<int> /* new_routing_ids */) |
| 104 | 100 |
| 105 IPC_MESSAGE_ROUTED2(WorkerMsg_Connect, | 101 IPC_MESSAGE_ROUTED2(WorkerMsg_Connect, |
| 106 int /* sent_message_port_id */, | 102 int /* sent_message_port_id */, |
| 107 int /* routing_id */) | 103 int /* routing_id */) |
| 108 | 104 |
| 109 IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed) | 105 IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed) |
| 110 IPC_END_MESSAGES(Worker) | |
| 111 | 106 |
| 112 | 107 |
| 113 //----------------------------------------------------------------------------- | 108 //----------------------------------------------------------------------------- |
| 114 // WorkerHost messages | 109 // WorkerHost messages |
| 115 // These are messages sent from the worker process to the renderer process. | 110 // These are messages sent from the worker process to the renderer process. |
| 116 IPC_BEGIN_MESSAGES(WorkerHost) | 111 // WorkerMsg_PostMessage is also sent here. |
| 117 // WorkerMsg_PostMessage is also sent here. | 112 IPC_MESSAGE_ROUTED3(WorkerHostMsg_PostExceptionToWorkerObject, |
| 118 IPC_MESSAGE_ROUTED3(WorkerHostMsg_PostExceptionToWorkerObject, | 113 string16 /* error_message */, |
| 119 string16 /* error_message */, | 114 int /* line_number */, |
| 120 int /* line_number */, | 115 string16 /* source_url*/) |
| 121 string16 /* source_url*/) | |
| 122 | 116 |
| 123 IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject, | 117 IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject, |
| 124 WorkerHostMsg_PostConsoleMessageToWorkerObject_Params) | 118 WorkerHostMsg_PostConsoleMessageToWorkerObject_Params) |
| 125 | 119 |
| 126 IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject, | 120 IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject, |
| 127 bool /* bool has_pending_activity */) | 121 bool /* bool has_pending_activity */) |
| 128 | 122 |
| 129 IPC_MESSAGE_ROUTED1(WorkerHostMsg_ReportPendingActivity, | 123 IPC_MESSAGE_ROUTED1(WorkerHostMsg_ReportPendingActivity, |
| 130 bool /* bool has_pending_activity */) | 124 bool /* bool has_pending_activity */) |
| 131 | 125 |
| 132 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed, | 126 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed, |
| 133 int /* worker_route_id */) | 127 int /* worker_route_id */) |
| 134 IPC_MESSAGE_ROUTED0(WorkerHostMsg_WorkerContextDestroyed) | 128 IPC_MESSAGE_ROUTED0(WorkerHostMsg_WorkerContextDestroyed) |
| 135 IPC_END_MESSAGES(WorkerHost) | |
| OLD | NEW |