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

Side by Side Diff: chrome/browser/debugger/devtools_http_protocol_handler.cc

Issue 5986001: DevTools: a better fix for socket closure crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/debugger/devtools_http_protocol_handler.h" 5 #include "chrome/browser/debugger/devtools_http_protocol_handler.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return; 256 return;
257 } 257 }
258 258
259 manager->ForwardToDevToolsAgent( 259 manager->ForwardToDevToolsAgent(
260 it->second, 260 it->second,
261 DevToolsAgentMsg_DispatchOnInspectorBackend(data)); 261 DevToolsAgentMsg_DispatchOnInspectorBackend(data));
262 } 262 }
263 263
264 void DevToolsHttpProtocolHandler::OnCloseUI(HttpListenSocket* socket) { 264 void DevToolsHttpProtocolHandler::OnCloseUI(HttpListenSocket* socket) {
265 SocketToClientHostMap::iterator it = socket_to_client_host_ui_.find(socket); 265 SocketToClientHostMap::iterator it = socket_to_client_host_ui_.find(socket);
266 if (it == socket_to_client_host_ui_.end()) 266 if (it != socket_to_client_host_ui_.end()) {
267 return; 267 DevToolsClientHostImpl* client_host =
268 DevToolsClientHostImpl* client_host = 268 static_cast<DevToolsClientHostImpl*>(it->second);
269 static_cast<DevToolsClientHostImpl*>(it->second); 269 client_host->NotifyCloseListener();
270 client_host->NotifyCloseListener(); 270 delete client_host;
271 delete client_host; 271 socket_to_client_host_ui_.erase(socket);
272 socket_to_client_host_ui_.erase(socket); 272 }
273 273
274 // We are holding last reference to scoped refptr 'socket' here. 274 // We are holding last reference to scoped refptr 'socket' here.
275 // We can't exit method just like that since 'socket' is going to 275 // We can't exit method just like that since 'socket' is going to
276 // be destroyed on the UI thread then. Schedule no-op to IO thread 276 // be destroyed on the UI thread then. Schedule no-op to IO thread
277 // so that socket is destroyed on IO instead. 277 // so that socket is destroyed on IO instead.
278 BrowserThread::PostTask( 278 BrowserThread::PostTask(
279 BrowserThread::IO, 279 BrowserThread::IO,
280 FROM_HERE, 280 FROM_HERE,
281 NewRunnableMethod( 281 NewRunnableMethod(
282 this, 282 this,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 TabStripModel* model = (*it)->tabstrip_model(); 427 TabStripModel* model = (*it)->tabstrip_model();
428 for (int i = 0, size = model->count(); i < size; ++i) { 428 for (int i = 0, size = model->count(); i < size; ++i) {
429 NavigationController& controller = 429 NavigationController& controller =
430 model->GetTabContentsAt(i)->controller(); 430 model->GetTabContentsAt(i)->controller();
431 if (controller.session_id().id() == session_id) 431 if (controller.session_id().id() == session_id)
432 return controller.tab_contents(); 432 return controller.tab_contents();
433 } 433 }
434 } 434 }
435 return NULL; 435 return NULL;
436 } 436 }
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