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

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

Issue 1737019: Fix browser process crash in WorkerTest.WorkerContextMultiPort. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 8 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
« no previous file with comments | « no previous file | chrome/worker/worker_uitest.cc » ('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/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/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/renderer_host/resource_message_filter.h" 10 #include "chrome/browser/renderer_host/resource_message_filter.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 port.queue_messages = false; 230 port.queue_messages = false;
231 port.queued_messages.insert(port.queued_messages.begin(), 231 port.queued_messages.insert(port.queued_messages.begin(),
232 queued_messages.begin(), 232 queued_messages.begin(),
233 queued_messages.end()); 233 queued_messages.end());
234 SendQueuedMessagesIfPossible(message_port_id); 234 SendQueuedMessagesIfPossible(message_port_id);
235 DCHECK(CheckMessagePortMap(true)); 235 DCHECK(CheckMessagePortMap(true));
236 } 236 }
237 237
238 void MessagePortDispatcher::SendQueuedMessagesIfPossible(int message_port_id) { 238 void MessagePortDispatcher::SendQueuedMessagesIfPossible(int message_port_id) {
239 DCHECK(CheckMessagePortMap(true)); 239 DCHECK(CheckMessagePortMap(true));
240 if (!message_ports_.count(message_port_id)) {
241 NOTREACHED();
242 return;
243 }
244
240 MessagePort& port = message_ports_[message_port_id]; 245 MessagePort& port = message_ports_[message_port_id];
241 if (port.queue_messages || !port.sender) 246 if (port.queue_messages || !port.sender)
242 return; 247 return;
243 248
244 for (QueuedMessages::iterator iter = port.queued_messages.begin(); 249 for (QueuedMessages::iterator iter = port.queued_messages.begin();
245 iter != port.queued_messages.end(); ++iter) { 250 iter != port.queued_messages.end(); ++iter) {
246 PostMessageTo(message_port_id, iter->first, iter->second); 251 PostMessageTo(message_port_id, iter->first, iter->second);
247 } 252 }
248 port.queued_messages.clear(); 253 port.queued_messages.clear();
249 DCHECK(CheckMessagePortMap(true)); 254 DCHECK(CheckMessagePortMap(true));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 int entangled_id = iter->second.entangled_message_port_id; 307 int entangled_id = iter->second.entangled_message_port_id;
303 if (check_entanglements && entangled_id != MSG_ROUTING_NONE) { 308 if (check_entanglements && entangled_id != MSG_ROUTING_NONE) {
304 MessagePorts::iterator entangled_item = message_ports_.find(entangled_id); 309 MessagePorts::iterator entangled_item = message_ports_.find(entangled_id);
305 DCHECK(entangled_item != message_ports_.end()); 310 DCHECK(entangled_item != message_ports_.end());
306 DCHECK(entangled_item->second.entangled_message_port_id == iter->first); 311 DCHECK(entangled_item->second.entangled_message_port_id == iter->first);
307 } 312 }
308 } 313 }
309 return true; 314 return true;
310 } 315 }
311 #endif // NDEBUG 316 #endif // NDEBUG
OLDNEW
« no previous file with comments | « no previous file | chrome/worker/worker_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698