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

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

Powered by Google App Engine
This is Rietveld 408576698