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

Side by Side Diff: chrome/browser/worker_host/message_port_dispatcher.cc

Issue 5173005: Fix crash in web workers when entangled port sender is null. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « no previous file | no next file » | 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/browser/worker_host/message_port_dispatcher.h" 5 #include "chrome/browser/worker_host/message_port_dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "chrome/browser/browser_thread.h" 9 #include "chrome/browser/browser_thread.h"
10 #include "chrome/browser/renderer_host/resource_message_filter.h" 10 #include "chrome/browser/renderer_host/resource_message_filter.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 sent_ports[i]->sender = entangled_port.sender; 192 sent_ports[i]->sender = entangled_port.sender;
193 193
194 // Update the entry for the sent port as it can be in a different process. 194 // Update the entry for the sent port as it can be in a different process.
195 sent_ports[i]->route_id = new_routing_ids[i]; 195 sent_ports[i]->route_id = new_routing_ids[i];
196 } 196 }
197 197
198 // Now send the message to the entangled port. 198 // Now send the message to the entangled port.
199 IPC::Message* ipc_msg = new WorkerProcessMsg_Message( 199 IPC::Message* ipc_msg = new WorkerProcessMsg_Message(
200 entangled_port.route_id, message, sent_message_port_ids, 200 entangled_port.route_id, message, sent_message_port_ids,
201 new_routing_ids); 201 new_routing_ids);
202 entangled_port.sender->Send(ipc_msg); 202
levin 2010/11/18 05:06:40 John is the right person to review this and can ho
inferno 2010/11/18 06:12:52 Done.
203 if (entangled_port.sender)
204 entangled_port.sender->Send(ipc_msg);
203 } 205 }
204 } 206 }
205 207
206 void MessagePortDispatcher::OnQueueMessages(int message_port_id) { 208 void MessagePortDispatcher::OnQueueMessages(int message_port_id) {
207 if (!message_ports_.count(message_port_id)) { 209 if (!message_ports_.count(message_port_id)) {
208 NOTREACHED(); 210 NOTREACHED();
209 return; 211 return;
210 } 212 }
211 213
212 MessagePort& port = message_ports_[message_port_id]; 214 MessagePort& port = message_ports_[message_port_id];
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 int entangled_id = erase_item->second.entangled_message_port_id; 281 int entangled_id = erase_item->second.entangled_message_port_id;
280 if (entangled_id != MSG_ROUTING_NONE) { 282 if (entangled_id != MSG_ROUTING_NONE) {
281 // Do the disentanglement (and be paranoid about the other side existing 283 // Do the disentanglement (and be paranoid about the other side existing
282 // just in case something unusual happened during entanglement). 284 // just in case something unusual happened during entanglement).
283 if (message_ports_.count(entangled_id)) { 285 if (message_ports_.count(entangled_id)) {
284 message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; 286 message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE;
285 } 287 }
286 } 288 }
287 message_ports_.erase(erase_item); 289 message_ports_.erase(erase_item);
288 } 290 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698