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..b159ce6f1b8d69f45238bd0201840c3cb42568bb |
| --- /dev/null |
| +++ b/net/http/http_pipelined_host_pool.h |
| @@ -0,0 +1,60 @@ |
| +// 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. |
| +// |
| +// 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. |
| + |
| +#ifndef NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ |
| +#define NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ |
| +#pragma once |
| + |
| +#include <map> |
| + |
| +#include <base/basictypes.h> |
| + |
| +namespace net { |
| + |
| +class HostPortPair; |
| +class HttpPipelinedHost; |
| +class HttpStreamFactory; |
| + |
| +class HttpPipelinedHostPool { |
| + public: |
| + HttpPipelinedHostPool(HttpStreamFactory* factory); |
|
willchan no longer on Chromium
2011/07/19 13:29:38
explicit
James Simonsen
2011/07/19 22:54:23
Done.
|
| + ~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. |
| + |
| + // Called when a pipelined host has no outstanding pipelined connections. |
| + void OnHostIdle(HttpPipelinedHost* host); |
| + |
| + // Called when a pipelined host has newly available pipeline capacity. |
| + void OnHostHasAdditionalCapacity(HttpPipelinedHost* host); |
| + |
| + private: |
| + HttpPipelinedHost* GetPipelinedHost(const HostPortPair& origin, |
| + bool create_if_not_found); |
| + |
| + HttpStreamFactory* factory_; |
| + typedef std::map<const HostPortPair, HttpPipelinedHost*> HostMap; |
| + HostMap host_map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool); |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ |