| Index: net/http/http_pipelined_host_pool.h
|
| diff --git a/net/http/http_pipelined_host_pool.h b/net/http/http_pipelined_host_pool.h
|
| index 5e7c146efd76e93d07e9119e3ecd27d514c3cdcc..3be0cb51e9eb4d56ebabc012c8efebd764b20bb7 100644
|
| --- a/net/http/http_pipelined_host_pool.h
|
| +++ b/net/http/http_pipelined_host_pool.h
|
| @@ -9,21 +9,37 @@
|
| #include <map>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/gtest_prod_util.h"
|
| +#include "base/memory/mru_cache.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "net/http/http_pipelined_host.h"
|
|
|
| namespace net {
|
|
|
| class HostPortPair;
|
| class HttpPipelinedStream;
|
| -class HttpStreamFactoryImpl;
|
|
|
| // Manages all of the pipelining state for specific host with active pipelined
|
| // HTTP requests. Manages connection jobs, constructs pipelined streams, and
|
| // assigns requests to the least loaded pipelined connection.
|
| -class HttpPipelinedHostPool : public HttpPipelinedHost::Delegate {
|
| +class NET_EXPORT_PRIVATE HttpPipelinedHostPool
|
| + : public HttpPipelinedHost::Delegate {
|
| public:
|
| - explicit HttpPipelinedHostPool(HttpStreamFactoryImpl* factory);
|
| - ~HttpPipelinedHostPool();
|
| + class Delegate {
|
| + public:
|
| + // Called when a HttpPipelinedHost has new capacity. Attempts to allocate
|
| + // any pending pipeline-capable requests to pipelines.
|
| + virtual void OnHttpPipelinedHostHasAdditionalCapacity(
|
| + const HostPortPair& origin) = 0;
|
| + };
|
| +
|
| + HttpPipelinedHostPool(Delegate* delegate,
|
| + HttpPipelinedHost::Factory* factory);
|
| + virtual ~HttpPipelinedHostPool();
|
| +
|
| + // Returns true if pipelining might work for |origin|. Generally, this returns
|
| + // true, unless |origin| is known to have failed pipelining recently.
|
| + bool IsHostEligibleForPipelining(const HostPortPair& origin);
|
|
|
| // Constructs a new pipeline on |connection| and returns a new
|
| // HttpPipelinedStream that uses it.
|
| @@ -49,14 +65,24 @@ class HttpPipelinedHostPool : public HttpPipelinedHost::Delegate {
|
|
|
| virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) OVERRIDE;
|
|
|
| + virtual void OnHostDeterminedCapability(
|
| + HttpPipelinedHost* host,
|
| + HttpPipelinedHost::Capability capability) OVERRIDE;
|
| +
|
| private:
|
| + typedef base::MRUCache<HostPortPair,
|
| + HttpPipelinedHost::Capability> CapabilityMap;
|
| typedef std::map<const HostPortPair, HttpPipelinedHost*> HostMap;
|
|
|
| HttpPipelinedHost* GetPipelinedHost(const HostPortPair& origin,
|
| bool create_if_not_found);
|
|
|
| - HttpStreamFactoryImpl* factory_;
|
| + HttpPipelinedHost::Capability GetHostCapability(const HostPortPair& origin);
|
| +
|
| + Delegate* delegate_;
|
| + scoped_ptr<HttpPipelinedHost::Factory> factory_;
|
| HostMap host_map_;
|
| + CapabilityMap known_capability_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool);
|
| };
|
|
|