| 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 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Returns the time tick when Init() was called. | 86 // Returns the time tick when Init() was called. |
| 87 base::TimeTicks init_time() const { return init_time_; } | 87 base::TimeTicks init_time() const { return init_time_; } |
| 88 | 88 |
| 89 // Returns the time between Init() and when is_initialized() becomes true. | 89 // Returns the time between Init() and when is_initialized() becomes true. |
| 90 base::TimeDelta setup_time() const { return setup_time_; } | 90 base::TimeDelta setup_time() const { return setup_time_; } |
| 91 | 91 |
| 92 // Used by ClientSocketPool to initialize the ClientSocketHandle. | 92 // Used by ClientSocketPool to initialize the ClientSocketHandle. |
| 93 void set_is_reused(bool is_reused) { is_reused_ = is_reused; } | 93 void set_is_reused(bool is_reused) { is_reused_ = is_reused; } |
| 94 void set_socket(ClientSocket* s) { socket_.reset(s); } | 94 void set_socket(ClientSocket* s) { socket_.reset(s); } |
| 95 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } | 95 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } |
| 96 void set_pool_id(int id) { pool_id_ = id; } |
| 96 | 97 |
| 97 // These may only be used if is_initialized() is true. | 98 // These may only be used if is_initialized() is true. |
| 98 const std::string& group_name() const { return group_name_; } | 99 const std::string& group_name() const { return group_name_; } |
| 99 ClientSocket* socket() { return socket_.get(); } | 100 ClientSocket* socket() { return socket_.get(); } |
| 100 ClientSocket* release_socket() { return socket_.release(); } | 101 ClientSocket* release_socket() { return socket_.release(); } |
| 101 bool is_reused() const { return is_reused_; } | 102 bool is_reused() const { return is_reused_; } |
| 102 base::TimeDelta idle_time() const { return idle_time_; } | 103 base::TimeDelta idle_time() const { return idle_time_; } |
| 103 SocketReuseType reuse_type() const { | 104 SocketReuseType reuse_type() const { |
| 104 if (is_reused()) { | 105 if (is_reused()) { |
| 105 return REUSED_IDLE; | 106 return REUSED_IDLE; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 135 // not to try to cancel the request with the ClientSocketPool. | 136 // not to try to cancel the request with the ClientSocketPool. |
| 136 void ResetInternal(bool cancel); | 137 void ResetInternal(bool cancel); |
| 137 | 138 |
| 138 scoped_refptr<ClientSocketPool> pool_; | 139 scoped_refptr<ClientSocketPool> pool_; |
| 139 scoped_ptr<ClientSocket> socket_; | 140 scoped_ptr<ClientSocket> socket_; |
| 140 std::string group_name_; | 141 std::string group_name_; |
| 141 bool is_reused_; | 142 bool is_reused_; |
| 142 CompletionCallbackImpl<ClientSocketHandle> callback_; | 143 CompletionCallbackImpl<ClientSocketHandle> callback_; |
| 143 CompletionCallback* user_callback_; | 144 CompletionCallback* user_callback_; |
| 144 base::TimeDelta idle_time_; | 145 base::TimeDelta idle_time_; |
| 146 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. |
| 145 base::TimeTicks init_time_; | 147 base::TimeTicks init_time_; |
| 146 base::TimeDelta setup_time_; | 148 base::TimeDelta setup_time_; |
| 147 | 149 |
| 148 NetLog::Source requesting_source_; | 150 NetLog::Source requesting_source_; |
| 149 | 151 |
| 150 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); | 152 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); |
| 151 }; | 153 }; |
| 152 | 154 |
| 153 // Template function implementation: | 155 // Template function implementation: |
| 154 template <typename SocketParams, typename PoolType> | 156 template <typename SocketParams, typename PoolType> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 175 user_callback_ = callback; | 177 user_callback_ = callback; |
| 176 } else { | 178 } else { |
| 177 HandleInitCompletion(rv); | 179 HandleInitCompletion(rv); |
| 178 } | 180 } |
| 179 return rv; | 181 return rv; |
| 180 } | 182 } |
| 181 | 183 |
| 182 } // namespace net | 184 } // namespace net |
| 183 | 185 |
| 184 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 186 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| OLD | NEW |