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 "chrome/renderer/webworker_proxy.h" | 5 #include "chrome/renderer/webworker_proxy.h" |
6 | 6 |
7 #include "chrome/common/child_thread.h" | 7 #include "chrome/common/child_thread.h" |
8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
9 #include "chrome/common/worker_messages.h" | 9 #include "chrome/common/worker_messages.h" |
10 #include "webkit/api/public/WebURL.h" | 10 #include "webkit/api/public/WebURL.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 IPC_BEGIN_MESSAGE_MAP(WebWorkerProxy, message) | 107 IPC_BEGIN_MESSAGE_MAP(WebWorkerProxy, message) |
108 IPC_MESSAGE_HANDLER(ViewMsg_DedicatedWorkerCreated, | 108 IPC_MESSAGE_HANDLER(ViewMsg_DedicatedWorkerCreated, |
109 OnDedicatedWorkerCreated) | 109 OnDedicatedWorkerCreated) |
110 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostMessageToWorkerObject, | 110 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostMessageToWorkerObject, |
111 client_, | 111 client_, |
112 WebWorkerClient::postMessageToWorkerObject) | 112 WebWorkerClient::postMessageToWorkerObject) |
113 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostExceptionToWorkerObject, | 113 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostExceptionToWorkerObject, |
114 client_, | 114 client_, |
115 WebWorkerClient::postExceptionToWorkerObject) | 115 WebWorkerClient::postExceptionToWorkerObject) |
116 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostConsoleMessageToWorkerObject, | 116 IPC_MESSAGE_HANDLER(WorkerHostMsg_PostConsoleMessageToWorkerObject, |
117 client_, | 117 OnPostConsoleMessageToWorkerObject) |
118 WebWorkerClient::postConsoleMessageToWorkerObject) | |
119 IPC_MESSAGE_FORWARD(WorkerHostMsg_ConfirmMessageFromWorkerObject, | 118 IPC_MESSAGE_FORWARD(WorkerHostMsg_ConfirmMessageFromWorkerObject, |
120 client_, | 119 client_, |
121 WebWorkerClient::confirmMessageFromWorkerObject) | 120 WebWorkerClient::confirmMessageFromWorkerObject) |
122 IPC_MESSAGE_FORWARD(WorkerHostMsg_ReportPendingActivity, | 121 IPC_MESSAGE_FORWARD(WorkerHostMsg_ReportPendingActivity, |
123 client_, | 122 client_, |
124 WebWorkerClient::reportPendingActivity) | 123 WebWorkerClient::reportPendingActivity) |
125 IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed, | 124 IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed, |
126 client_, | 125 client_, |
127 WebWorkerClient::workerContextDestroyed) | 126 WebWorkerClient::workerContextDestroyed) |
128 IPC_END_MESSAGE_MAP() | 127 IPC_END_MESSAGE_MAP() |
129 } | 128 } |
130 | 129 |
131 void WebWorkerProxy::OnDedicatedWorkerCreated() { | 130 void WebWorkerProxy::OnDedicatedWorkerCreated() { |
132 DCHECK(queued_messages_.size()); | 131 DCHECK(queued_messages_.size()); |
133 std::vector<IPC::Message*> queued_messages = queued_messages_; | 132 std::vector<IPC::Message*> queued_messages = queued_messages_; |
134 queued_messages_.clear(); | 133 queued_messages_.clear(); |
135 for (size_t i = 0; i < queued_messages.size(); ++i) { | 134 for (size_t i = 0; i < queued_messages.size(); ++i) { |
136 queued_messages[i]->set_routing_id(route_id_); | 135 queued_messages[i]->set_routing_id(route_id_); |
137 Send(queued_messages[i]); | 136 Send(queued_messages[i]); |
138 } | 137 } |
139 } | 138 } |
| 139 |
| 140 void WebWorkerProxy::OnPostConsoleMessageToWorkerObject( |
| 141 const WorkerHostMsg_PostConsoleMessageToWorkerObject_Params& params) { |
| 142 client_->postConsoleMessageToWorkerObject(params.destination_identifier, |
| 143 params.source_identifier, params.message_type, params.message_level, |
| 144 params.message, params.line_number, params.source_url); |
| 145 } |
| 146 |
OLD | NEW |