Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6db3db787f40fc50cd53692205d96ca55b975a6b |
| --- /dev/null |
| +++ b/net/http/http_pipelined_host_pool.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ |
| +#define NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ |
| +#pragma once |
| + |
| +#include <map> |
| + |
| +#include "base/basictypes.h" |
| +#include "net/http/http_pipelined_host.h" |
| + |
| +namespace net { |
| + |
| +class HostPortPair; |
| +class HttpStreamFactory; |
| + |
| +// 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 { |
| + public: |
| + explicit HttpPipelinedHostPool(HttpStreamFactory* factory); |
| + ~HttpPipelinedHostPool(); |
| + |
| + // Returns the HttpPipelinedHost used for this origin, or a new one if none |
| + // exists. |
| + HttpPipelinedHost* GetOrCreatePipelinedHost(const HostPortPair& origin) { |
| + return GetPipelinedHost(origin, true); |
| + } |
| + |
| + // Returns the HttpPipelinedHost used for this origin, or NULL if none exists. |
| + HttpPipelinedHost* GetPipelinedHostIfExists(const HostPortPair& origin) { |
| + return GetPipelinedHost(origin, false); |
| + } |
| + |
| + // Callbacks for HttpPipelinedHost. |
| + virtual void OnHostIdle(HttpPipelinedHost* host) OVERRIDE; |
| + |
| + virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) OVERRIDE; |
| + |
| + private: |
| + HttpPipelinedHost* GetPipelinedHost(const HostPortPair& origin, |
| + bool create_if_not_found); |
| + |
| + HttpStreamFactory* factory_; |
| + typedef std::map<const HostPortPair, HttpPipelinedHost*> HostMap; |
|
willchan no longer on Chromium
2011/09/26 23:49:20
types go first in the access control section, a la
James Simonsen
2011/09/29 02:39:31
Done.
|
| + HostMap host_map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool); |
|
willchan no longer on Chromium
2011/09/26 23:49:20
Include base/basictypes.h for this
James Simonsen
2011/09/29 02:39:31
Done.
|
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ |