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 "net/socket/client_socket_handle.h" | 5 #include "net/socket/client_socket_handle.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/trace_event/trace_event.h" |
13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
14 #include "net/socket/client_socket_pool.h" | 15 #include "net/socket/client_socket_pool.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 ClientSocketHandle::ClientSocketHandle() | 19 ClientSocketHandle::ClientSocketHandle() |
19 : is_initialized_(false), | 20 : is_initialized_(false), |
20 pool_(NULL), | 21 pool_(NULL), |
21 higher_pool_(NULL), | 22 higher_pool_(NULL), |
22 reuse_type_(ClientSocketHandle::UNUSED), | 23 reuse_type_(ClientSocketHandle::UNUSED), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 load_timing_info->connect_timing = connect_timing_; | 135 load_timing_info->connect_timing = connect_timing_; |
135 return true; | 136 return true; |
136 } | 137 } |
137 | 138 |
138 void ClientSocketHandle::SetSocket(scoped_ptr<StreamSocket> s) { | 139 void ClientSocketHandle::SetSocket(scoped_ptr<StreamSocket> s) { |
139 socket_ = std::move(s); | 140 socket_ = std::move(s); |
140 } | 141 } |
141 | 142 |
142 void ClientSocketHandle::OnIOComplete(int result) { | 143 void ClientSocketHandle::OnIOComplete(int result) { |
| 144 TRACE_EVENT0("net", "ClientSocketHandle::OnIOComplete"); |
143 CompletionCallback callback = user_callback_; | 145 CompletionCallback callback = user_callback_; |
144 user_callback_.Reset(); | 146 user_callback_.Reset(); |
145 HandleInitCompletion(result); | 147 HandleInitCompletion(result); |
146 callback.Run(result); | 148 callback.Run(result); |
147 } | 149 } |
148 | 150 |
149 scoped_ptr<StreamSocket> ClientSocketHandle::PassSocket() { | 151 scoped_ptr<StreamSocket> ClientSocketHandle::PassSocket() { |
150 return std::move(socket_); | 152 return std::move(socket_); |
151 } | 153 } |
152 | 154 |
(...skipping 14 matching lines...) Expand all Loading... |
167 // TODO(eroman): This logging is not complete, in particular set_socket() and | 169 // TODO(eroman): This logging is not complete, in particular set_socket() and |
168 // release() socket. It ends up working though, since those methods are being | 170 // release() socket. It ends up working though, since those methods are being |
169 // used to layer sockets (and the destination sources are the same). | 171 // used to layer sockets (and the destination sources are the same). |
170 DCHECK(socket_.get()); | 172 DCHECK(socket_.get()); |
171 socket_->NetLog().BeginEvent( | 173 socket_->NetLog().BeginEvent( |
172 NetLog::TYPE_SOCKET_IN_USE, | 174 NetLog::TYPE_SOCKET_IN_USE, |
173 requesting_source_.ToEventParametersCallback()); | 175 requesting_source_.ToEventParametersCallback()); |
174 } | 176 } |
175 | 177 |
176 } // namespace net | 178 } // namespace net |
OLD | NEW |