OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
13 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
14 #include "net/http/http_pipelined_host_pool.h" | 14 #include "net/http/http_pipelined_host_pool.h" |
15 #include "net/http/http_stream_factory.h" | 15 #include "net/http/http_stream_factory.h" |
16 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 class HttpNetworkSession; | 20 class HttpNetworkSession; |
21 class HttpPipelinedHost; | 21 class HttpPipelinedHost; |
22 class SpdySession; | 22 class SpdySession; |
23 | 23 |
24 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : public HttpStreamFactory { | 24 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : |
| 25 public HttpStreamFactory, |
| 26 public HttpPipelinedHostPool::Delegate { |
25 public: | 27 public: |
26 explicit HttpStreamFactoryImpl(HttpNetworkSession* session); | 28 explicit HttpStreamFactoryImpl(HttpNetworkSession* session); |
27 virtual ~HttpStreamFactoryImpl(); | 29 virtual ~HttpStreamFactoryImpl(); |
28 | 30 |
29 // HttpStreamFactory Interface | 31 // HttpStreamFactory Interface |
30 virtual HttpStreamRequest* RequestStream( | 32 virtual HttpStreamRequest* RequestStream( |
31 const HttpRequestInfo& info, | 33 const HttpRequestInfo& info, |
32 const SSLConfig& server_ssl_config, | 34 const SSLConfig& server_ssl_config, |
33 const SSLConfig& proxy_ssl_config, | 35 const SSLConfig& proxy_ssl_config, |
34 HttpStreamRequest::Delegate* delegate, | 36 HttpStreamRequest::Delegate* delegate, |
35 const BoundNetLog& net_log) OVERRIDE; | 37 const BoundNetLog& net_log) OVERRIDE; |
36 | 38 |
37 virtual void PreconnectStreams(int num_streams, | 39 virtual void PreconnectStreams(int num_streams, |
38 const HttpRequestInfo& info, | 40 const HttpRequestInfo& info, |
39 const SSLConfig& server_ssl_config, | 41 const SSLConfig& server_ssl_config, |
40 const SSLConfig& proxy_ssl_config, | 42 const SSLConfig& proxy_ssl_config, |
41 const BoundNetLog& net_log) OVERRIDE; | 43 const BoundNetLog& net_log) OVERRIDE; |
42 virtual void AddTLSIntolerantServer(const HostPortPair& server) OVERRIDE; | 44 virtual void AddTLSIntolerantServer(const HostPortPair& server) OVERRIDE; |
43 virtual bool IsTLSIntolerantServer(const HostPortPair& server) const OVERRIDE; | 45 virtual bool IsTLSIntolerantServer(const HostPortPair& server) const OVERRIDE; |
44 | 46 |
45 // Called when a HttpPipelinedHost has new capacity. Attempts to allocate any | 47 // HttpPipelinedHostPool::Delegate Interface |
46 // pending pipeline-capable requests to pipelines. | |
47 virtual void OnHttpPipelinedHostHasAdditionalCapacity( | 48 virtual void OnHttpPipelinedHostHasAdditionalCapacity( |
48 const HostPortPair& origin); | 49 const HostPortPair& origin) OVERRIDE; |
49 | 50 |
50 private: | 51 private: |
51 class Request; | 52 class Request; |
52 class Job; | 53 class Job; |
53 | 54 |
54 typedef std::set<Request*> RequestSet; | 55 typedef std::set<Request*> RequestSet; |
55 typedef std::map<HostPortProxyPair, RequestSet> SpdySessionRequestMap; | 56 typedef std::map<HostPortProxyPair, RequestSet> SpdySessionRequestMap; |
56 typedef std::map<HostPortPair, RequestSet> HttpPipeliningRequestMap; | 57 typedef std::map<HostPortPair, RequestSet> HttpPipeliningRequestMap; |
57 | 58 |
58 bool GetAlternateProtocolRequestFor(const GURL& original_url, | 59 bool GetAlternateProtocolRequestFor(const GURL& original_url, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // object. They're owned by HttpStreamFactoryImpl. Leftover jobs will be | 112 // object. They're owned by HttpStreamFactoryImpl. Leftover jobs will be |
112 // deleted when the factory is destroyed. | 113 // deleted when the factory is destroyed. |
113 std::set<const Job*> preconnect_job_set_; | 114 std::set<const Job*> preconnect_job_set_; |
114 | 115 |
115 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl); | 116 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl); |
116 }; | 117 }; |
117 | 118 |
118 } // namespace net | 119 } // namespace net |
119 | 120 |
120 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 121 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |
OLD | NEW |