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

Side by Side Diff: net/http/http_stream_factory_impl.h

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_stream_factory.cc ('k') | net/http/http_stream_factory_impl.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) 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"
14 #include "net/http/http_pipelined_host_pool.h"
13 #include "net/http/http_stream_factory.h" 15 #include "net/http/http_stream_factory.h"
14 #include "net/base/net_log.h"
15 #include "net/proxy/proxy_server.h" 16 #include "net/proxy/proxy_server.h"
16 17
17 namespace net { 18 namespace net {
18 19
19 class HttpNetworkSession; 20 class HttpNetworkSession;
21 class HttpPipelinedHost;
20 class SpdySession; 22 class SpdySession;
21 23
22 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : public HttpStreamFactory { 24 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : public HttpStreamFactory {
23 public: 25 public:
24 explicit HttpStreamFactoryImpl(HttpNetworkSession* session); 26 explicit HttpStreamFactoryImpl(HttpNetworkSession* session);
25 virtual ~HttpStreamFactoryImpl(); 27 virtual ~HttpStreamFactoryImpl();
26 28
27 // HttpStreamFactory Interface 29 // HttpStreamFactory Interface
28 virtual HttpStreamRequest* RequestStream( 30 virtual HttpStreamRequest* RequestStream(
29 const HttpRequestInfo& info, 31 const HttpRequestInfo& info,
30 const SSLConfig& server_ssl_config, 32 const SSLConfig& server_ssl_config,
31 const SSLConfig& proxy_ssl_config, 33 const SSLConfig& proxy_ssl_config,
32 HttpStreamRequest::Delegate* delegate, 34 HttpStreamRequest::Delegate* delegate,
33 const BoundNetLog& net_log); 35 const BoundNetLog& net_log);
34 36
35 virtual void PreconnectStreams(int num_streams, 37 virtual void PreconnectStreams(int num_streams,
36 const HttpRequestInfo& info, 38 const HttpRequestInfo& info,
37 const SSLConfig& server_ssl_config, 39 const SSLConfig& server_ssl_config,
38 const SSLConfig& proxy_ssl_config, 40 const SSLConfig& proxy_ssl_config,
39 const BoundNetLog& net_log); 41 const BoundNetLog& net_log);
40 virtual void AddTLSIntolerantServer(const HostPortPair& server); 42 virtual void AddTLSIntolerantServer(const HostPortPair& server);
41 virtual bool IsTLSIntolerantServer(const HostPortPair& server) const; 43 virtual bool IsTLSIntolerantServer(const HostPortPair& server) const;
42 44
45 // Called when a HttpPipelinedHost has new capacity. Attempts to allocate any
46 // pending pipeline-capable requests to pipelines.
47 virtual void OnHttpPipelinedHostHasAdditionalCapacity(
48 const HostPortPair& origin);
49
43 private: 50 private:
44 class Request; 51 class Request;
45 class Job; 52 class Job;
46 53
47 typedef std::set<Request*> RequestSet; 54 typedef std::set<Request*> RequestSet;
48 typedef std::map<HostPortProxyPair, RequestSet> SpdySessionRequestMap; 55 typedef std::map<HostPortProxyPair, RequestSet> SpdySessionRequestMap;
56 typedef std::map<HostPortPair, RequestSet> HttpPipeliningRequestMap;
49 57
50 bool GetAlternateProtocolRequestFor(const GURL& original_url, 58 bool GetAlternateProtocolRequestFor(const GURL& original_url,
51 GURL* alternate_url) const; 59 GURL* alternate_url) const;
52 60
53 // Detaches |job| from |request|. 61 // Detaches |job| from |request|.
54 void OrphanJob(Job* job, const Request* request); 62 void OrphanJob(Job* job, const Request* request);
55 63
56 // Called when a SpdySession is ready. It will find appropriate Requests and 64 // Called when a SpdySession is ready. It will find appropriate Requests and
57 // fulfill them. |direct| indicates whether or not |spdy_session| uses a 65 // fulfill them. |direct| indicates whether or not |spdy_session| uses a
58 // proxy. 66 // proxy.
(...skipping 22 matching lines...) Expand all
81 HttpNetworkSession* const session_; 89 HttpNetworkSession* const session_;
82 90
83 std::set<HostPortPair> tls_intolerant_servers_; 91 std::set<HostPortPair> tls_intolerant_servers_;
84 92
85 // All Requests are handed out to clients. By the time HttpStreamFactoryImpl 93 // All Requests are handed out to clients. By the time HttpStreamFactoryImpl
86 // is destroyed, all Requests should be deleted (which should remove them from 94 // is destroyed, all Requests should be deleted (which should remove them from
87 // |request_map_|. The Requests will delete the corresponding job. 95 // |request_map_|. The Requests will delete the corresponding job.
88 std::map<const Job*, Request*> request_map_; 96 std::map<const Job*, Request*> request_map_;
89 97
90 SpdySessionRequestMap spdy_session_request_map_; 98 SpdySessionRequestMap spdy_session_request_map_;
99 HttpPipeliningRequestMap http_pipelining_request_map_;
100
101 HttpPipelinedHostPool http_pipelined_host_pool_;
91 102
92 // These jobs correspond to jobs orphaned by Requests and now owned by 103 // These jobs correspond to jobs orphaned by Requests and now owned by
93 // HttpStreamFactoryImpl. Since they are no longer tied to Requests, they will 104 // HttpStreamFactoryImpl. Since they are no longer tied to Requests, they will
94 // not be canceled when Requests are canceled. Therefore, in 105 // not be canceled when Requests are canceled. Therefore, in
95 // ~HttpStreamFactoryImpl, it is possible for some jobs to still exist in this 106 // ~HttpStreamFactoryImpl, it is possible for some jobs to still exist in this
96 // set. Leftover jobs will be deleted when the factory is destroyed. 107 // set. Leftover jobs will be deleted when the factory is destroyed.
97 std::set<const Job*> orphaned_job_set_; 108 std::set<const Job*> orphaned_job_set_;
98 109
99 // These jobs correspond to preconnect requests and have no associated Request 110 // These jobs correspond to preconnect requests and have no associated Request
100 // object. They're owned by HttpStreamFactoryImpl. Leftover jobs will be 111 // object. They're owned by HttpStreamFactoryImpl. Leftover jobs will be
101 // deleted when the factory is destroyed. 112 // deleted when the factory is destroyed.
102 std::set<const Job*> preconnect_job_set_; 113 std::set<const Job*> preconnect_job_set_;
103 114
104 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl); 115 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl);
105 }; 116 };
106 117
107 } // namespace net 118 } // namespace net
108 119
109 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 120 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory.cc ('k') | net/http/http_stream_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698