OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 5 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/renderer_host/socket_stream_host.h" | 10 #include "content/browser/renderer_host/socket_stream_host.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int socket_id = id.request_id; | 184 int socket_id = id.request_id; |
185 DVLOG(2) << "SocketStreamDispatcherHost::ContinueSSLRequest socket_id=" | 185 DVLOG(2) << "SocketStreamDispatcherHost::ContinueSSLRequest socket_id=" |
186 << socket_id; | 186 << socket_id; |
187 DCHECK_NE(kNoSocketId, socket_id); | 187 DCHECK_NE(kNoSocketId, socket_id); |
188 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); | 188 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
189 DCHECK(socket_stream_host); | 189 DCHECK(socket_stream_host); |
190 socket_stream_host->ContinueDespiteError(); | 190 socket_stream_host->ContinueDespiteError(); |
191 } | 191 } |
192 | 192 |
193 SocketStreamDispatcherHost::~SocketStreamDispatcherHost() { | 193 SocketStreamDispatcherHost::~SocketStreamDispatcherHost() { |
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 194 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
195 Shutdown(); | 195 Shutdown(); |
196 } | 196 } |
197 | 197 |
198 // Message handlers called by OnMessageReceived. | 198 // Message handlers called by OnMessageReceived. |
199 void SocketStreamDispatcherHost::OnConnect(int render_frame_id, | 199 void SocketStreamDispatcherHost::OnConnect(int render_frame_id, |
200 const GURL& url, | 200 const GURL& url, |
201 int socket_id) { | 201 int socket_id) { |
202 DVLOG(2) << "SocketStreamDispatcherHost::OnConnect" | 202 DVLOG(2) << "SocketStreamDispatcherHost::OnConnect" |
203 << " render_frame_id=" << render_frame_id | 203 << " render_frame_id=" << render_frame_id |
204 << " url=" << url | 204 << " url=" << url |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (!Send(new SocketStreamMsg_Closed(socket_id))) { | 261 if (!Send(new SocketStreamMsg_Closed(socket_id))) { |
262 DVLOG(1) << "SocketStreamMsg_Closed failed."; | 262 DVLOG(1) << "SocketStreamMsg_Closed failed."; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { | 266 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { |
267 return request_context_callback_.Run(ResourceType::SUB_RESOURCE); | 267 return request_context_callback_.Run(ResourceType::SUB_RESOURCE); |
268 } | 268 } |
269 | 269 |
270 void SocketStreamDispatcherHost::Shutdown() { | 270 void SocketStreamDispatcherHost::Shutdown() { |
271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 271 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
272 // TODO(ukai): Implement IDMap::RemoveAll(). | 272 // TODO(ukai): Implement IDMap::RemoveAll(). |
273 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_); | 273 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_); |
274 !iter.IsAtEnd(); | 274 !iter.IsAtEnd(); |
275 iter.Advance()) { | 275 iter.Advance()) { |
276 int socket_id = iter.GetCurrentKey(); | 276 int socket_id = iter.GetCurrentKey(); |
277 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 277 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
278 delete socket_stream_host; | 278 delete socket_stream_host; |
279 hosts_.Remove(socket_id); | 279 hosts_.Remove(socket_id); |
280 } | 280 } |
281 on_shutdown_ = true; | 281 on_shutdown_ = true; |
282 } | 282 } |
283 | 283 |
284 } // namespace content | 284 } // namespace content |
OLD | NEW |