| 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_TCP_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 
| 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <string> | 9 #include <string> | 
| 10 | 10 | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32   TCPSocketParams(const std::string& host, int port, RequestPriority priority, | 32   TCPSocketParams(const std::string& host, int port, RequestPriority priority, | 
| 33                   const GURL& referrer, bool disable_resolver_cache); | 33                   const GURL& referrer, bool disable_resolver_cache); | 
| 34 | 34 | 
| 35   const HostResolver::RequestInfo& destination() const { return destination_; } | 35   const HostResolver::RequestInfo& destination() const { return destination_; } | 
| 36 | 36 | 
| 37  private: | 37  private: | 
| 38   friend class base::RefCounted<TCPSocketParams>; | 38   friend class base::RefCounted<TCPSocketParams>; | 
| 39   ~TCPSocketParams(); | 39   ~TCPSocketParams(); | 
| 40 | 40 | 
| 41   void Initialize(RequestPriority priority, const GURL& referrer, | 41   void Initialize(RequestPriority priority, const GURL& referrer, | 
| 42                   bool disable_resolver_cache) { | 42                   bool disable_resolver_cache); | 
| 43     // The referrer is used by the DNS prefetch system to correlate resolutions |  | 
| 44     // with the page that triggered them. It doesn't impact the actual addresses |  | 
| 45     // that we resolve to. |  | 
| 46     destination_.set_referrer(referrer); |  | 
| 47     destination_.set_priority(priority); |  | 
| 48     if (disable_resolver_cache) |  | 
| 49       destination_.set_allow_cached_response(false); |  | 
| 50   } |  | 
| 51 | 43 | 
| 52   HostResolver::RequestInfo destination_; | 44   HostResolver::RequestInfo destination_; | 
| 53 | 45 | 
| 54   DISALLOW_COPY_AND_ASSIGN(TCPSocketParams); | 46   DISALLOW_COPY_AND_ASSIGN(TCPSocketParams); | 
| 55 }; | 47 }; | 
| 56 | 48 | 
| 57 // TCPConnectJob handles the host resolution necessary for socket creation | 49 // TCPConnectJob handles the host resolution necessary for socket creation | 
| 58 // and the tcp connect. | 50 // and the tcp connect. | 
| 59 class TCPConnectJob : public ConnectJob { | 51 class TCPConnectJob : public ConnectJob { | 
| 60  public: | 52  public: | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 140                              ClientSocketHandle* handle); | 132                              ClientSocketHandle* handle); | 
| 141 | 133 | 
| 142   virtual void ReleaseSocket(const std::string& group_name, | 134   virtual void ReleaseSocket(const std::string& group_name, | 
| 143                              ClientSocket* socket, | 135                              ClientSocket* socket, | 
| 144                              int id); | 136                              int id); | 
| 145 | 137 | 
| 146   virtual void Flush(); | 138   virtual void Flush(); | 
| 147 | 139 | 
| 148   virtual void CloseIdleSockets(); | 140   virtual void CloseIdleSockets(); | 
| 149 | 141 | 
| 150   virtual int IdleSocketCount() const { | 142   virtual int IdleSocketCount() const; | 
| 151     return base_.idle_socket_count(); |  | 
| 152   } |  | 
| 153 | 143 | 
| 154   virtual int IdleSocketCountInGroup(const std::string& group_name) const; | 144   virtual int IdleSocketCountInGroup(const std::string& group_name) const; | 
| 155 | 145 | 
| 156   virtual LoadState GetLoadState(const std::string& group_name, | 146   virtual LoadState GetLoadState(const std::string& group_name, | 
| 157                                  const ClientSocketHandle* handle) const; | 147                                  const ClientSocketHandle* handle) const; | 
| 158 | 148 | 
| 159   virtual DictionaryValue* GetInfoAsValue(const std::string& name, | 149   virtual DictionaryValue* GetInfoAsValue(const std::string& name, | 
| 160                                           const std::string& type, | 150                                           const std::string& type, | 
| 161                                           bool include_nested_pools) const { | 151                                           bool include_nested_pools) const; | 
| 162     return base_.GetInfoAsValue(name, type); |  | 
| 163   } |  | 
| 164 | 152 | 
| 165   virtual base::TimeDelta ConnectionTimeout() const { | 153   virtual base::TimeDelta ConnectionTimeout() const; | 
| 166     return base_.ConnectionTimeout(); |  | 
| 167   } |  | 
| 168 | 154 | 
| 169   virtual ClientSocketPoolHistograms* histograms() const { | 155   virtual ClientSocketPoolHistograms* histograms() const; | 
| 170     return base_.histograms(); |  | 
| 171   } |  | 
| 172 | 156 | 
| 173  private: | 157  private: | 
| 174   typedef ClientSocketPoolBase<TCPSocketParams> PoolBase; | 158   typedef ClientSocketPoolBase<TCPSocketParams> PoolBase; | 
| 175 | 159 | 
| 176   class TCPConnectJobFactory | 160   class TCPConnectJobFactory | 
| 177       : public PoolBase::ConnectJobFactory { | 161       : public PoolBase::ConnectJobFactory { | 
| 178    public: | 162    public: | 
| 179     TCPConnectJobFactory(ClientSocketFactory* client_socket_factory, | 163     TCPConnectJobFactory(ClientSocketFactory* client_socket_factory, | 
| 180                          HostResolver* host_resolver, | 164                          HostResolver* host_resolver, | 
| 181                          NetLog* net_log) | 165                          NetLog* net_log) | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 205   PoolBase base_; | 189   PoolBase base_; | 
| 206 | 190 | 
| 207   DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); | 191   DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); | 
| 208 }; | 192 }; | 
| 209 | 193 | 
| 210 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams); | 194 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams); | 
| 211 | 195 | 
| 212 }  // namespace net | 196 }  // namespace net | 
| 213 | 197 | 
| 214 #endif  // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 198 #endif  // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 
| OLD | NEW | 
|---|