| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 if (hosts_.Lookup(socket_id)) { | 219 if (hosts_.Lookup(socket_id)) { |
| 220 DVLOG(1) << "socket_id=" << socket_id << " already registered."; | 220 DVLOG(1) << "socket_id=" << socket_id << " already registered."; |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 | 223 |
| 224 // Note that the SocketStreamHost is responsible for checking that |url| | 224 // Note that the SocketStreamHost is responsible for checking that |url| |
| 225 // is valid. | 225 // is valid. |
| 226 SocketStreamHost* socket_stream_host = | 226 SocketStreamHost* socket_stream_host = |
| 227 new SocketStreamHost(this, render_process_id_, render_frame_id, | 227 new SocketStreamHost(this, render_frame_id, socket_id); |
| 228 socket_id); | |
| 229 hosts_.AddWithID(socket_stream_host, socket_id); | 228 hosts_.AddWithID(socket_stream_host, socket_id); |
| 230 socket_stream_host->Connect(url, GetURLRequestContext()); | 229 socket_stream_host->Connect(url, GetURLRequestContext()); |
| 231 DVLOG(2) << "SocketStreamDispatcherHost::OnConnect -> " << socket_id; | 230 DVLOG(2) << "SocketStreamDispatcherHost::OnConnect -> " << socket_id; |
| 232 } | 231 } |
| 233 | 232 |
| 234 void SocketStreamDispatcherHost::OnSendData( | 233 void SocketStreamDispatcherHost::OnSendData( |
| 235 int socket_id, const std::vector<char>& data) { | 234 int socket_id, const std::vector<char>& data) { |
| 236 DVLOG(2) << "SocketStreamDispatcherHost::OnSendData socket_id=" << socket_id; | 235 DVLOG(2) << "SocketStreamDispatcherHost::OnSendData socket_id=" << socket_id; |
| 237 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); | 236 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
| 238 if (!socket_stream_host) { | 237 if (!socket_stream_host) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 iter.Advance()) { | 274 iter.Advance()) { |
| 276 int socket_id = iter.GetCurrentKey(); | 275 int socket_id = iter.GetCurrentKey(); |
| 277 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 276 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
| 278 delete socket_stream_host; | 277 delete socket_stream_host; |
| 279 hosts_.Remove(socket_id); | 278 hosts_.Remove(socket_id); |
| 280 } | 279 } |
| 281 on_shutdown_ = true; | 280 on_shutdown_ = true; |
| 282 } | 281 } |
| 283 | 282 |
| 284 } // namespace content | 283 } // namespace content |
| OLD | NEW |