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

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: Merged 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
diff --git a/net/http/http_pipelined_host_pool.cc b/net/http/http_pipelined_host_pool.cc
index fa705a03401d024ec8752dc21186008c6706094c..71eb0aeaaca79245b687e74aa7b362d362f068eb 100644
--- a/net/http/http_pipelined_host_pool.cc
+++ b/net/http/http_pipelined_host_pool.cc
@@ -6,31 +6,29 @@
#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,
- HttpPipelinedHost::Capability capability) OVERRIDE {
+ HttpPipelinedHostCapability capability) OVERRIDE {
return new HttpPipelinedHostImpl(delegate, origin, factory, capability);
}
};
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,8 +40,9 @@ HttpPipelinedHostPool::~HttpPipelinedHostPool() {
bool HttpPipelinedHostPool::IsHostEligibleForPipelining(
const HostPortPair& origin) {
- HttpPipelinedHost::Capability capability = GetHostCapability(origin);
- return capability != HttpPipelinedHost::INCAPABLE;
+ HttpPipelinedHostCapability capability =
+ http_server_properties_->GetPipelineCapability(origin);
+ return capability != PIPELINE_INCAPABLE;
}
HttpPipelinedStream* HttpPipelinedHostPool::CreateStreamOnNewPipeline(
@@ -90,8 +89,9 @@ HttpPipelinedHost* HttpPipelinedHostPool::GetPipelinedHost(
return NULL;
}
- HttpPipelinedHost::Capability capability = GetHostCapability(origin);
- if (capability == HttpPipelinedHost::INCAPABLE) {
+ HttpPipelinedHostCapability capability =
+ http_server_properties_->GetPipelineCapability(origin);
+ if (capability == PIPELINE_INCAPABLE) {
return NULL;
}
@@ -115,22 +115,8 @@ 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;
+ HttpPipelinedHostCapability capability) {
+ http_server_properties_->SetPipelineCapability(host->origin(), 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