Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: net/socket/client_socket_handle.h

Issue 2647003: Do not attempt to reuse active sockets after a socket pool flush (usually a network change). (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Address eroman comments. Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/socket/client_socket_handle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/socket/client_socket_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698