Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 // Manages all of the pipelining state for specific host with active pipelined | |
| 6 // HTTP requests. Manages connection jobs, constructs pipelined streams, and | |
| 7 // assigns requests to the least loaded pipelined connection. | |
| 8 | |
| 9 #ifndef NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ | |
| 10 #define NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ | |
| 11 #pragma once | |
| 12 | |
| 13 #include <map> | |
| 14 | |
| 15 #include <base/basictypes.h> | |
| 16 | |
| 17 namespace net { | |
| 18 | |
| 19 class HostPortPair; | |
| 20 class HttpPipelinedHost; | |
| 21 class HttpStreamFactory; | |
| 22 | |
| 23 class HttpPipelinedHostPool { | |
| 24 public: | |
| 25 HttpPipelinedHostPool(HttpStreamFactory* factory); | |
|
willchan no longer on Chromium
2011/07/19 13:29:38
explicit
James Simonsen
2011/07/19 22:54:23
Done.
| |
| 26 ~HttpPipelinedHostPool(); | |
| 27 | |
| 28 // Returns the HttpPipelinedHost used for this origin, or a new one if none | |
| 29 // exists. | |
| 30 HttpPipelinedHost* GetOrCreatePipelinedHost(const HostPortPair& origin) { | |
| 31 return GetPipelinedHost(origin, true); | |
| 32 } | |
| 33 | |
| 34 // Returns the HttpPipelinedHost used for this origin, or NULL if none exists. | |
| 35 HttpPipelinedHost* GetPipelinedHostIfExists(const HostPortPair& origin) { | |
| 36 return GetPipelinedHost(origin, false); | |
| 37 } | |
| 38 | |
| 39 // Callbacks for HttpPipelinedHost. | |
| 40 | |
| 41 // Called when a pipelined host has no outstanding pipelined connections. | |
| 42 void OnHostIdle(HttpPipelinedHost* host); | |
| 43 | |
| 44 // Called when a pipelined host has newly available pipeline capacity. | |
| 45 void OnHostHasAdditionalCapacity(HttpPipelinedHost* host); | |
| 46 | |
| 47 private: | |
| 48 HttpPipelinedHost* GetPipelinedHost(const HostPortPair& origin, | |
| 49 bool create_if_not_found); | |
| 50 | |
| 51 HttpStreamFactory* factory_; | |
| 52 typedef std::map<const HostPortPair, HttpPipelinedHost*> HostMap; | |
| 53 HostMap host_map_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostPool); | |
| 56 }; | |
| 57 | |
| 58 } // namespace net | |
| 59 | |
| 60 #endif // NET_HTTP_HTTP_PIPELINED_HOST_POOL_H_ | |
| OLD | NEW |