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

Unified Diff: net/http/http_pipelined_host_pool.cc

Issue 8770035: Save pipelining capabilities for the most used hosts between sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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.cc
diff --git a/net/http/http_pipelined_host_pool.cc b/net/http/http_pipelined_host_pool.cc
index fa705a03401d024ec8752dc21186008c6706094c..a54d67b4c0af47cb05723bf578dd9890d68fbb45 100644
--- a/net/http/http_pipelined_host_pool.cc
+++ b/net/http/http_pipelined_host_pool.cc
@@ -7,14 +7,10 @@
#include "base/logging.h"
#include "base/stl_util.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(
@@ -27,10 +23,11 @@ class HttpPipelinedHostImplFactory : public HttpPipelinedHost::Factory {
HttpPipelinedHostPool::HttpPipelinedHostPool(
Delegate* delegate,
- HttpPipelinedHost::Factory* factory)
+ HttpPipelinedHost::Factory* factory,
+ HttpServerProperties* http_server_properties)
: delegate_(delegate),
factory_(factory),
- known_capability_map_(kNumHostsToRemember) {
+ http_server_properties_(http_server_properties) {
if (!factory) {
factory_.reset(new HttpPipelinedHostImplFactory);
}
@@ -42,7 +39,8 @@ HttpPipelinedHostPool::~HttpPipelinedHostPool() {
bool HttpPipelinedHostPool::IsHostEligibleForPipelining(
const HostPortPair& origin) {
- HttpPipelinedHost::Capability capability = GetHostCapability(origin);
+ HttpPipelinedHost::Capability capability =
+ http_server_properties_->GetPipelineCapability(origin);
return capability != HttpPipelinedHost::INCAPABLE;
}
@@ -90,7 +88,8 @@ HttpPipelinedHost* HttpPipelinedHostPool::GetPipelinedHost(
return NULL;
}
- HttpPipelinedHost::Capability capability = GetHostCapability(origin);
+ HttpPipelinedHost::Capability capability =
+ http_server_properties_->GetPipelineCapability(origin);
if (capability == HttpPipelinedHost::INCAPABLE) {
return NULL;
}
@@ -116,21 +115,7 @@ void HttpPipelinedHostPool::OnHostHasAdditionalCapacity(
void HttpPipelinedHostPool::OnHostDeterminedCapability(
HttpPipelinedHost* host,
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;
+ http_server_properties_->SetPipelineCapability(host->origin(), capability);
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698