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

Unified Diff: net/http/http_pipelined_host_pool.h

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use HttpStreamFactoryImpl::Job Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698