OLD | NEW |
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 it2 != it->second.end(); ++it2) { | 149 it2 != it->second.end(); ++it2) { |
150 net::URLRequest* request = *it2; | 150 net::URLRequest* request = *it2; |
151 request->Cancel(); | 151 request->Cancel(); |
152 request_to_socket_io_.erase(request); | 152 request_to_socket_io_.erase(request); |
153 request_to_buffer_io_.erase(request); | 153 request_to_buffer_io_.erase(request); |
154 delete request; | 154 delete request; |
155 } | 155 } |
156 socket_to_requests_io_.erase(socket); | 156 socket_to_requests_io_.erase(socket); |
157 } | 157 } |
158 | 158 |
159 // This can't use make_scoped_refptr because |socket| is already deleted | |
160 // when this runs -- http://crbug.com/59930 | |
161 BrowserThread::PostTask( | 159 BrowserThread::PostTask( |
162 BrowserThread::UI, | 160 BrowserThread::UI, |
163 FROM_HERE, | 161 FROM_HERE, |
164 NewRunnableMethod( | 162 NewRunnableMethod( |
165 this, | 163 this, |
166 &DevToolsHttpProtocolHandler::OnCloseUI, | 164 &DevToolsHttpProtocolHandler::OnCloseUI, |
167 socket)); | 165 make_scoped_refptr(socket))); |
168 } | 166 } |
169 | 167 |
170 void DevToolsHttpProtocolHandler::OnHttpRequestUI( | 168 void DevToolsHttpProtocolHandler::OnHttpRequestUI( |
171 HttpListenSocket* socket, | 169 HttpListenSocket* socket, |
172 const HttpServerRequestInfo& info) { | 170 const HttpServerRequestInfo& info) { |
173 std::string response = "<html><body>"; | 171 std::string response = "<html><body>"; |
174 for (BrowserList::const_iterator it = BrowserList::begin(), | 172 for (BrowserList::const_iterator it = BrowserList::begin(), |
175 end = BrowserList::end(); it != end; ++it) { | 173 end = BrowserList::end(); it != end; ++it) { |
176 TabStripModel* model = (*it)->tabstrip_model(); | 174 TabStripModel* model = (*it)->tabstrip_model(); |
177 for (int i = 0, size = model->count(); i < size; ++i) { | 175 for (int i = 0, size = model->count(); i < size; ++i) { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 TabStripModel* model = (*it)->tabstrip_model(); | 410 TabStripModel* model = (*it)->tabstrip_model(); |
413 for (int i = 0, size = model->count(); i < size; ++i) { | 411 for (int i = 0, size = model->count(); i < size; ++i) { |
414 NavigationController& controller = | 412 NavigationController& controller = |
415 model->GetTabContentsAt(i)->controller(); | 413 model->GetTabContentsAt(i)->controller(); |
416 if (controller.session_id().id() == session_id) | 414 if (controller.session_id().id() == session_id) |
417 return controller.tab_contents(); | 415 return controller.tab_contents(); |
418 } | 416 } |
419 } | 417 } |
420 return NULL; | 418 return NULL; |
421 } | 419 } |
OLD | NEW |