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

Unified Diff: net/http/http_pipelined_host_pool.cc

Issue 8833003: Revert 113315 (speculative revert for http://crbug.com/106657) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
« no previous file with comments | « net/http/http_pipelined_host_pool.h ('k') | net/http/http_pipelined_host_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_pipelined_host_pool.cc
===================================================================
--- net/http/http_pipelined_host_pool.cc (revision 113337)
+++ net/http/http_pipelined_host_pool.cc (working copy)
@@ -6,29 +6,31 @@
#include "base/logging.h"
#include "base/stl_util.h"
-#include "net/http/http_pipelined_host_capability.h"
#include "net/http/http_pipelined_host_impl.h"
-#include "net/http/http_server_properties.h"
namespace net {
+// TODO(simonjam): Run experiments with different values of this to see what
+// value is good at avoiding evictions without eating too much memory. Until
+// then, this is just a bad guess.
+static const int kNumHostsToRemember = 200;
+
class HttpPipelinedHostImplFactory : public HttpPipelinedHost::Factory {
public:
virtual HttpPipelinedHost* CreateNewHost(
HttpPipelinedHost::Delegate* delegate, const HostPortPair& origin,
HttpPipelinedConnection::Factory* factory,
- HttpPipelinedHostCapability capability) OVERRIDE {
+ HttpPipelinedHost::Capability capability) OVERRIDE {
return new HttpPipelinedHostImpl(delegate, origin, factory, capability);
}
};
HttpPipelinedHostPool::HttpPipelinedHostPool(
Delegate* delegate,
- HttpPipelinedHost::Factory* factory,
- HttpServerProperties* http_server_properties)
+ HttpPipelinedHost::Factory* factory)
: delegate_(delegate),
factory_(factory),
- http_server_properties_(http_server_properties) {
+ known_capability_map_(kNumHostsToRemember) {
if (!factory) {
factory_.reset(new HttpPipelinedHostImplFactory);
}
@@ -40,9 +42,8 @@
bool HttpPipelinedHostPool::IsHostEligibleForPipelining(
const HostPortPair& origin) {
- HttpPipelinedHostCapability capability =
- http_server_properties_->GetPipelineCapability(origin);
- return capability != PIPELINE_INCAPABLE;
+ HttpPipelinedHost::Capability capability = GetHostCapability(origin);
+ return capability != HttpPipelinedHost::INCAPABLE;
}
HttpPipelinedStream* HttpPipelinedHostPool::CreateStreamOnNewPipeline(
@@ -89,9 +90,8 @@
return NULL;
}
- HttpPipelinedHostCapability capability =
- http_server_properties_->GetPipelineCapability(origin);
- if (capability == PIPELINE_INCAPABLE) {
+ HttpPipelinedHost::Capability capability = GetHostCapability(origin);
+ if (capability == HttpPipelinedHost::INCAPABLE) {
return NULL;
}
@@ -115,8 +115,22 @@
void HttpPipelinedHostPool::OnHostDeterminedCapability(
HttpPipelinedHost* host,
- HttpPipelinedHostCapability capability) {
- http_server_properties_->SetPipelineCapability(host->origin(), capability);
+ HttpPipelinedHost::Capability capability) {
+ CapabilityMap::iterator known_it = known_capability_map_.Get(host->origin());
+ if (known_it == known_capability_map_.end() ||
+ known_it->second != HttpPipelinedHost::INCAPABLE) {
+ known_capability_map_.Put(host->origin(), capability);
+ }
}
+HttpPipelinedHost::Capability HttpPipelinedHostPool::GetHostCapability(
+ const HostPortPair& origin) {
+ HttpPipelinedHost::Capability capability = HttpPipelinedHost::UNKNOWN;
+ CapabilityMap::const_iterator it = known_capability_map_.Get(origin);
+ if (it != known_capability_map_.end()) {
+ capability = it->second;
+ }
+ return capability;
+}
+
} // namespace net
« no previous file with comments | « net/http/http_pipelined_host_pool.h ('k') | net/http/http_pipelined_host_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698