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

Unified Diff: net/http/http_pipelined_host.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.h
diff --git a/net/http/http_pipelined_host.h b/net/http/http_pipelined_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..981bfcbf9831a835ebf5a4c36e8e2ffc28b92c23
--- /dev/null
+++ b/net/http/http_pipelined_host.h
@@ -0,0 +1,68 @@
+// 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_H_
+#define NET_HTTP_HTTP_PIPELINED_HOST_H_
+#pragma once
+
+#include <set>
+#include <string>
+
+#include "net/base/host_port_pair.h"
+
+namespace net {
+
+class BoundNetLog;
+class ClientSocketHandle;
+class HttpPipelinedConnection;
+class HttpPipelinedHostPool;
+class ProxyInfo;
+class SSLConfig;
+
+class HttpPipelinedHost {
+ public:
+ HttpPipelinedHost(HttpPipelinedHostPool* pool,
+ const HostPortPair& origin);
+ ~HttpPipelinedHost();
+
+ HttpPipelinedConnection* CreateNewPipeline(ClientSocketHandle* connection,
+ const SSLConfig& used_ssl_config,
+ const ProxyInfo& used_proxy_info,
+ const BoundNetLog& net_log,
+ bool was_npn_negotiated);
+
+ HttpPipelinedConnection* FindAvailablePipeline();
+
+ // Callbacks for HttpPipelinedConnection.
+
+ // Called when a pipelined connection completes a request. Adds a pending
+ // request to the pipeline if the pipeline is still usable.
+ void OnPipelineHasCapacity(HttpPipelinedConnection* pipeline);
+
+ const HostPortPair& origin() const { return origin_; }
+
+ private:
+ // Called when a pipeline is empty and there are no pending requests. Closes
+ // the connection.
+ void OnPipelineEmpty(HttpPipelinedConnection* pipeline);
+
+ // Adds the next pending request to the pipeline if it's still usuable.
+ void AddRequestToPipeline(HttpPipelinedConnection* connection);
+
+ int max_pipeline_depth() const { return 3; }
+
+ HttpPipelinedHostPool* pool_;
+ const HostPortPair origin_;
+ std::set<HttpPipelinedConnection*> pipelines_;
+
+ DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHost);
+};
+
+} // namespace net
+
+#endif // NET_HTTP_HTTP_PIPELINED_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698