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

Side by Side Diff: chrome/renderer/webworker_proxy.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/webworker_proxy.h ('k') | chrome/service/service_ipc_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/webmessageportchannel_impl.h" 9 #include "chrome/common/webmessageportchannel_impl.h"
10 #include "chrome/common/worker_messages.h" 10 #include "chrome/common/worker_messages.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 void WebWorkerProxy::workerObjectDestroyed() { 79 void WebWorkerProxy::workerObjectDestroyed() {
80 Send(new WorkerMsg_WorkerObjectDestroyed(route_id_)); 80 Send(new WorkerMsg_WorkerObjectDestroyed(route_id_));
81 delete this; 81 delete this;
82 } 82 }
83 83
84 void WebWorkerProxy::clientDestroyed() { 84 void WebWorkerProxy::clientDestroyed() {
85 } 85 }
86 86
87 void WebWorkerProxy::OnMessageReceived(const IPC::Message& message) { 87 bool WebWorkerProxy::OnMessageReceived(const IPC::Message& message) {
88 if (!client_) 88 if (!client_)
89 return; 89 return false;
90 90
91 bool handled = true;
91 IPC_BEGIN_MESSAGE_MAP(WebWorkerProxy, message) 92 IPC_BEGIN_MESSAGE_MAP(WebWorkerProxy, message)
92 IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated) 93 IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated)
93 IPC_MESSAGE_HANDLER(WorkerMsg_PostMessage, OnPostMessage) 94 IPC_MESSAGE_HANDLER(WorkerMsg_PostMessage, OnPostMessage)
94 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostExceptionToWorkerObject, 95 IPC_MESSAGE_FORWARD(WorkerHostMsg_PostExceptionToWorkerObject,
95 client_, 96 client_,
96 WebWorkerClient::postExceptionToWorkerObject) 97 WebWorkerClient::postExceptionToWorkerObject)
97 IPC_MESSAGE_HANDLER(WorkerHostMsg_PostConsoleMessageToWorkerObject, 98 IPC_MESSAGE_HANDLER(WorkerHostMsg_PostConsoleMessageToWorkerObject,
98 OnPostConsoleMessageToWorkerObject) 99 OnPostConsoleMessageToWorkerObject)
99 IPC_MESSAGE_FORWARD(WorkerHostMsg_ConfirmMessageFromWorkerObject, 100 IPC_MESSAGE_FORWARD(WorkerHostMsg_ConfirmMessageFromWorkerObject,
100 client_, 101 client_,
101 WebWorkerClient::confirmMessageFromWorkerObject) 102 WebWorkerClient::confirmMessageFromWorkerObject)
102 IPC_MESSAGE_FORWARD(WorkerHostMsg_ReportPendingActivity, 103 IPC_MESSAGE_FORWARD(WorkerHostMsg_ReportPendingActivity,
103 client_, 104 client_,
104 WebWorkerClient::reportPendingActivity) 105 WebWorkerClient::reportPendingActivity)
105 IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed, 106 IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed,
106 static_cast<WebCommonWorkerClient*>(client_), 107 static_cast<WebCommonWorkerClient*>(client_),
107 WebCommonWorkerClient::workerContextDestroyed) 108 WebCommonWorkerClient::workerContextDestroyed)
109 IPC_MESSAGE_UNHANDLED(handled = false)
108 IPC_END_MESSAGE_MAP() 110 IPC_END_MESSAGE_MAP()
111 return handled;
109 } 112 }
110 113
111 void WebWorkerProxy::OnWorkerCreated() { 114 void WebWorkerProxy::OnWorkerCreated() {
112 // The worker is created - now send off the CreateWorkerContext message and 115 // The worker is created - now send off the CreateWorkerContext message and
113 // any other queued messages 116 // any other queued messages
114 SendQueuedMessages(); 117 SendQueuedMessages();
115 } 118 }
116 119
117 void WebWorkerProxy::OnPostMessage( 120 void WebWorkerProxy::OnPostMessage(
118 const string16& message, 121 const string16& message,
119 const std::vector<int>& sent_message_port_ids, 122 const std::vector<int>& sent_message_port_ids,
120 const std::vector<int>& new_routing_ids) { 123 const std::vector<int>& new_routing_ids) {
121 DCHECK(new_routing_ids.size() == sent_message_port_ids.size()); 124 DCHECK(new_routing_ids.size() == sent_message_port_ids.size());
122 WebMessagePortChannelArray channels(sent_message_port_ids.size()); 125 WebMessagePortChannelArray channels(sent_message_port_ids.size());
123 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { 126 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) {
124 channels[i] = new WebMessagePortChannelImpl( 127 channels[i] = new WebMessagePortChannelImpl(
125 new_routing_ids[i], sent_message_port_ids[i]); 128 new_routing_ids[i], sent_message_port_ids[i]);
126 } 129 }
127 130
128 client_->postMessageToWorkerObject(message, channels); 131 client_->postMessageToWorkerObject(message, channels);
129 } 132 }
130 133
131 void WebWorkerProxy::OnPostConsoleMessageToWorkerObject( 134 void WebWorkerProxy::OnPostConsoleMessageToWorkerObject(
132 const WorkerHostMsg_PostConsoleMessageToWorkerObject_Params& params) { 135 const WorkerHostMsg_PostConsoleMessageToWorkerObject_Params& params) {
133 client_->postConsoleMessageToWorkerObject(params.source_identifier, 136 client_->postConsoleMessageToWorkerObject(params.source_identifier,
134 params.message_type, params.message_level, 137 params.message_type, params.message_level,
135 params.message, params.line_number, params.source_url); 138 params.message, params.line_number, params.source_url);
136 } 139 }
137 140
OLDNEW
« no previous file with comments | « chrome/renderer/webworker_proxy.h ('k') | chrome/service/service_ipc_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698