summaryrefslogtreecommitdiffstats
path: root/net/http/http_server_properties_impl.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 03:53:02 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 03:53:02 +0000
commitd1a3edbfce9a5e91e1fed6bc1ac857ec1cc91089 (patch)
treec76b35ab5a541e2d7d06f15a65e540a9da58424d /net/http/http_server_properties_impl.cc
parentfc3ff06f4687604132f7727e4d8bb2e1dd3b6934 (diff)
downloadchromium_src-d1a3edbfce9a5e91e1fed6bc1ac857ec1cc91089.zip
chromium_src-d1a3edbfce9a5e91e1fed6bc1ac857ec1cc91089.tar.gz
chromium_src-d1a3edbfce9a5e91e1fed6bc1ac857ec1cc91089.tar.bz2
Revert 113338 - Revert 113315 (speculative revert for http://crbug.com/106657)
- Save pipelining capabilities for the most used hosts between sessions. BUG=None TEST=unit_tests Review URL: http://codereview.chromium.org/8770035 TBR=simonjam@chromium.org Review URL: http://codereview.chromium.org/8833003 TBR=thakis@chromium.org Review URL: http://codereview.chromium.org/8832003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_server_properties_impl.cc')
-rw-r--r--net/http/http_server_properties_impl.cc63
1 files changed, 62 insertions, 1 deletions
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index d4e1303..b8a7ed1 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -8,10 +8,18 @@
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/stringprintf.h"
+#include "net/http/http_pipelined_host_capability.h"
namespace net {
-HttpServerPropertiesImpl::HttpServerPropertiesImpl() {
+// 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 kDefaultNumHostsToRemember = 200;
+
+HttpServerPropertiesImpl::HttpServerPropertiesImpl()
+ : pipeline_capability_map_(
+ new CachedPipelineCapabilityMap(kDefaultNumHostsToRemember)) {
}
HttpServerPropertiesImpl::~HttpServerPropertiesImpl() {
@@ -48,6 +56,21 @@ void HttpServerPropertiesImpl::InitializeSpdySettingsServers(
spdy_settings_map_.swap(*spdy_settings_map);
}
+void HttpServerPropertiesImpl::InitializePipelineCapabilities(
+ const PipelineCapabilityMap* pipeline_capability_map) {
+ PipelineCapabilityMap::const_iterator it;
+ pipeline_capability_map_->Clear();
+ for (it = pipeline_capability_map->begin();
+ it != pipeline_capability_map->end(); ++it) {
+ pipeline_capability_map_->Put(it->first, it->second);
+ }
+}
+
+void HttpServerPropertiesImpl::SetNumPipelinedHostsToRemember(int max_size) {
+ DCHECK(pipeline_capability_map_->empty());
+ pipeline_capability_map_.reset(new CachedPipelineCapabilityMap(max_size));
+}
+
void HttpServerPropertiesImpl::GetSpdyServerList(
base::ListValue* spdy_server_list) const {
DCHECK(CalledOnValidThread());
@@ -94,6 +117,7 @@ void HttpServerPropertiesImpl::Clear() {
spdy_servers_table_.clear();
alternate_protocol_map_.clear();
spdy_settings_map_.clear();
+ pipeline_capability_map_->Clear();
}
bool HttpServerPropertiesImpl::SupportsSpdy(
@@ -239,4 +263,41 @@ HttpServerPropertiesImpl::spdy_settings_map() const {
return spdy_settings_map_;
}
+HttpPipelinedHostCapability HttpServerPropertiesImpl::GetPipelineCapability(
+ const HostPortPair& origin) {
+ HttpPipelinedHostCapability capability = PIPELINE_UNKNOWN;
+ CachedPipelineCapabilityMap::const_iterator it =
+ pipeline_capability_map_->Get(origin);
+ if (it != pipeline_capability_map_->end()) {
+ capability = it->second;
+ }
+ return capability;
+}
+
+void HttpServerPropertiesImpl::SetPipelineCapability(
+ const HostPortPair& origin,
+ HttpPipelinedHostCapability capability) {
+ CachedPipelineCapabilityMap::iterator it =
+ pipeline_capability_map_->Peek(origin);
+ if (it == pipeline_capability_map_->end() ||
+ it->second != PIPELINE_INCAPABLE) {
+ pipeline_capability_map_->Put(origin, capability);
+ }
+}
+
+void HttpServerPropertiesImpl::ClearPipelineCapabilities() {
+ pipeline_capability_map_->Clear();
+}
+
+PipelineCapabilityMap
+HttpServerPropertiesImpl::GetPipelineCapabilityMap() const {
+ PipelineCapabilityMap result;
+ CachedPipelineCapabilityMap::const_iterator it;
+ for (it = pipeline_capability_map_->begin();
+ it != pipeline_capability_map_->end(); ++it) {
+ result[it->first] = it->second;
+ }
+ return result;
+}
+
} // namespace net