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

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

Issue 9433015: Add a force pipelining option to load flags. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix build on other platforms Created 8 years, 10 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
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_PIPELINED_HOST_POOL_H_ 5 #ifndef NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_
6 #define NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ 6 #define NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 17 matching lines...) Expand all
28 // HTTP requests. Manages connection jobs, constructs pipelined streams, and 28 // HTTP requests. Manages connection jobs, constructs pipelined streams, and
29 // assigns requests to the least loaded pipelined connection. 29 // assigns requests to the least loaded pipelined connection.
30 class NET_EXPORT_PRIVATE HttpPipelinedHostPool 30 class NET_EXPORT_PRIVATE HttpPipelinedHostPool
31 : public HttpPipelinedHost::Delegate { 31 : public HttpPipelinedHost::Delegate {
32 public: 32 public:
33 class Delegate { 33 class Delegate {
34 public: 34 public:
35 // Called when a HttpPipelinedHost has new capacity. Attempts to allocate 35 // Called when a HttpPipelinedHost has new capacity. Attempts to allocate
36 // any pending pipeline-capable requests to pipelines. 36 // any pending pipeline-capable requests to pipelines.
37 virtual void OnHttpPipelinedHostHasAdditionalCapacity( 37 virtual void OnHttpPipelinedHostHasAdditionalCapacity(
38 const HostPortPair& origin) = 0; 38 HttpPipelinedHost* host) = 0;
39 }; 39 };
40 40
41 HttpPipelinedHostPool(Delegate* delegate, 41 HttpPipelinedHostPool(Delegate* delegate,
42 HttpPipelinedHost::Factory* factory, 42 HttpPipelinedHost::Factory* factory,
43 HttpServerProperties* http_server_properties_); 43 HttpServerProperties* http_server_properties_);
44 virtual ~HttpPipelinedHostPool(); 44 virtual ~HttpPipelinedHostPool();
45 45
46 // Returns true if pipelining might work for |origin|. Generally, this returns 46 // Returns true if pipelining might work for |key|. Generally, this returns
47 // true, unless |origin| is known to have failed pipelining recently. 47 // true, unless |key| is known to have failed pipelining recently.
48 bool IsHostEligibleForPipelining(const HostPortPair& origin); 48 bool IsKeyEligibleForPipelining(const HttpPipelinedHost::Key& key);
49 49
50 // Constructs a new pipeline on |connection| and returns a new 50 // Constructs a new pipeline on |connection| and returns a new
51 // HttpPipelinedStream that uses it. 51 // HttpPipelinedStream that uses it.
52 HttpPipelinedStream* CreateStreamOnNewPipeline( 52 HttpPipelinedStream* CreateStreamOnNewPipeline(
53 const HostPortPair& origin, 53 const HttpPipelinedHost::Key& key,
54 ClientSocketHandle* connection, 54 ClientSocketHandle* connection,
55 const SSLConfig& used_ssl_config, 55 const SSLConfig& used_ssl_config,
56 const ProxyInfo& used_proxy_info, 56 const ProxyInfo& used_proxy_info,
57 const BoundNetLog& net_log, 57 const BoundNetLog& net_log,
58 bool was_npn_negotiated, 58 bool was_npn_negotiated,
59 SSLClientSocket::NextProto protocol_negotiated); 59 SSLClientSocket::NextProto protocol_negotiated);
60 60
61 // Tries to find an existing pipeline with capacity for a new request. If 61 // Tries to find an existing pipeline with capacity for a new request. If
62 // successful, returns a new stream on that pipeline. Otherwise, returns NULL. 62 // successful, returns a new stream on that pipeline. Otherwise, returns NULL.
63 HttpPipelinedStream* CreateStreamOnExistingPipeline( 63 HttpPipelinedStream* CreateStreamOnExistingPipeline(
64 const HostPortPair& origin); 64 const HttpPipelinedHost::Key& key);
65 65
66 // Returns true if a pipelined connection already exists for this origin and 66 // Returns true if a pipelined connection already exists for |key| and
67 // can accept new requests. 67 // can accept new requests.
68 bool IsExistingPipelineAvailableForOrigin(const HostPortPair& origin); 68 bool IsExistingPipelineAvailableForKey(const HttpPipelinedHost::Key& key);
69 69
70 // Callbacks for HttpPipelinedHost. 70 // Callbacks for HttpPipelinedHost.
71 virtual void OnHostIdle(HttpPipelinedHost* host) OVERRIDE; 71 virtual void OnHostIdle(HttpPipelinedHost* host) OVERRIDE;
72 72
73 virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) OVERRIDE; 73 virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) OVERRIDE;
74 74
75 virtual void OnHostDeterminedCapability( 75 virtual void OnHostDeterminedCapability(
76 HttpPipelinedHost* host, 76 HttpPipelinedHost* host,
77 HttpPipelinedHostCapability capability) OVERRIDE; 77 HttpPipelinedHostCapability capability) OVERRIDE;
78 78
79 // Creates a Value summary of this pool's |host_map_|. Caller assumes 79 // Creates a Value summary of this pool's |host_map_|. Caller assumes
80 // ownership of the returned Value. 80 // ownership of the returned Value.
81 base::Value* PipelineInfoToValue() const; 81 base::Value* PipelineInfoToValue() const;
82 82
83 private: 83 private:
84 typedef std::map<const HostPortPair, HttpPipelinedHost*> HostMap; 84 typedef std::map<HttpPipelinedHost::Key, HttpPipelinedHost*> HostMap;
85 85
86 HttpPipelinedHost* GetPipelinedHost(const HostPortPair& origin, 86 HttpPipelinedHost* GetPipelinedHost(const HttpPipelinedHost::Key& key,
87 bool create_if_not_found); 87 bool create_if_not_found);
88 88
89 Delegate* delegate_; 89 Delegate* delegate_;
90 scoped_ptr<HttpPipelinedHost::Factory> factory_; 90 scoped_ptr<HttpPipelinedHost::Factory> factory_;
91 HostMap host_map_; 91 HostMap host_map_;
92 HttpServerProperties* http_server_properties_; 92 HttpServerProperties* http_server_properties_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool); 94 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool);
95 }; 95 };
96 96
97 } // namespace net 97 } // namespace net
98 98
99 #endif // NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ 99 #endif // NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698