Index: net/http/http_pipelined_host_impl.h |
diff --git a/net/http/http_pipelined_host.h b/net/http/http_pipelined_host_impl.h |
similarity index 58% |
copy from net/http/http_pipelined_host.h |
copy to net/http/http_pipelined_host_impl.h |
index ae3128d8054a75ec2a52d93a5b1e4a9d04550fc6..cf9bb16d1d070d82d65f3e9b1c39fc63df9678a9 100644 |
--- a/net/http/http_pipelined_host.h |
+++ b/net/http/http_pipelined_host_impl.h |
@@ -2,11 +2,11 @@ |
// 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_H_ |
-#define NET_HTTP_HTTP_PIPELINED_HOST_H_ |
+#ifndef NET_HTTP_HTTP_PIPELINED_HOST_IMPL_H_ |
+#define NET_HTTP_HTTP_PIPELINED_HOST_IMPL_H_ |
#pragma once |
-#include <set> |
+#include <map> |
#include <string> |
#include "base/basictypes.h" |
@@ -14,6 +14,7 @@ |
#include "net/base/host_port_pair.h" |
#include "net/base/net_export.h" |
#include "net/http/http_pipelined_connection.h" |
+#include "net/http/http_pipelined_host.h" |
namespace net { |
@@ -26,26 +27,17 @@ struct SSLConfig; |
// 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 NET_EXPORT_PRIVATE HttpPipelinedHost |
- : public HttpPipelinedConnection::Delegate { |
+class NET_EXPORT_PRIVATE HttpPipelinedHostImpl |
+ : public HttpPipelinedHost, |
+ public HttpPipelinedConnection::Delegate { |
public: |
- class Delegate { |
- public: |
- // Called when a pipelined host has no outstanding requests on any of its |
- // pipelined connections. |
- virtual void OnHostIdle(HttpPipelinedHost* host) = 0; |
- |
- // Called when a pipelined host has newly available pipeline capacity, like |
- // when a request completes. |
- virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) = 0; |
- }; |
- |
- HttpPipelinedHost(Delegate* delegate, const HostPortPair& origin, |
- HttpPipelinedConnection::Factory* factory); |
- virtual ~HttpPipelinedHost(); |
+ HttpPipelinedHostImpl(HttpPipelinedHost::Delegate* delegate, |
+ const HostPortPair& origin, |
+ HttpPipelinedConnection::Factory* factory, |
+ Capability capability); |
+ virtual ~HttpPipelinedHostImpl(); |
- // Constructs a new pipeline on |connection| and returns a new |
- // HttpPipelinedStream that uses it. |
+ // HttpPipelinedHost Interface |
HttpPipelinedStream* CreateStreamOnNewPipeline( |
ClientSocketHandle* connection, |
const SSLConfig& used_ssl_config, |
@@ -53,12 +45,8 @@ class NET_EXPORT_PRIVATE HttpPipelinedHost |
const BoundNetLog& net_log, |
bool was_npn_negotiated); |
mmenke
2011/11/17 22:25:37
This function and the next two should all use virt
James Simonsen
2011/11/18 00:03:56
Done.
|
- // Tries to find an existing pipeline with capacity for a new request. If |
- // successful, returns a new stream on that pipeline. Otherwise, returns NULL. |
HttpPipelinedStream* CreateStreamOnExistingPipeline(); |
- // Returns true if we have a pipelined connection that can accept new |
- // requests. |
bool IsExistingPipelineAvailable(); |
// Callbacks for HttpPipelinedConnection. |
@@ -68,9 +56,21 @@ class NET_EXPORT_PRIVATE HttpPipelinedHost |
virtual void OnPipelineHasCapacity( |
HttpPipelinedConnection* pipeline) OVERRIDE; |
- const HostPortPair& origin() const { return origin_; } |
+ virtual void OnPipelineFeedback( |
+ HttpPipelinedConnection* pipeline, |
+ HttpPipelinedConnection::Feedback feedback) OVERRIDE; |
+ |
+ virtual const HostPortPair& origin() const OVERRIDE; |
mmenke
2011/11/17 22:25:37
Now that this is virtual, it's no longer just a li
James Simonsen
2011/11/18 00:03:56
I added it to my task list. This CL is big enough.
|
private: |
+ struct PipelineInfo { |
+ PipelineInfo(); |
+ |
+ int capacity; |
+ int num_successes; |
+ }; |
+ typedef std::map<HttpPipelinedConnection*, PipelineInfo> PipelineInfoMap; |
+ |
// Called when a pipeline is empty and there are no pending requests. Closes |
// the connection. |
void OnPipelineEmpty(HttpPipelinedConnection* pipeline); |
@@ -80,14 +80,15 @@ class NET_EXPORT_PRIVATE HttpPipelinedHost |
int max_pipeline_depth() const { return 3; } |
- Delegate* delegate_; |
+ HttpPipelinedHost::Delegate* delegate_; |
const HostPortPair origin_; |
- std::set<HttpPipelinedConnection*> pipelines_; |
+ PipelineInfoMap pipelines_; |
scoped_ptr<HttpPipelinedConnection::Factory> factory_; |
+ Capability capability_; |
- DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHost); |
+ DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostImpl); |
}; |
} // namespace net |
-#endif // NET_HTTP_HTTP_PIPELINED_HOST_H_ |
+#endif // NET_HTTP_HTTP_PIPELINED_HOST_IMPL_H_ |