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

Unified Diff: net/http/http_server_properties_impl.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_server_properties_impl.cc
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index d4e1303b5dde9dc6c88d60ddba78a9f43f29f51e..17ca05500353f36c0e3c37bed4345b6c41b4ed52 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -11,7 +11,13 @@
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.
willchan no longer on Chromium 2011/12/02 23:35:29 Good idea. But perhaps we should put this in the c
James Simonsen 2011/12/03 03:16:00 Hmm. I started in on this, but that constructor is
+static const int kNumHostsToRemember = 200;
+
+HttpServerPropertiesImpl::HttpServerPropertiesImpl()
+ : pipeline_capability_map_(kNumHostsToRemember) {
}
HttpServerPropertiesImpl::~HttpServerPropertiesImpl() {
@@ -48,6 +54,16 @@ void HttpServerPropertiesImpl::InitializeSpdySettingsServers(
spdy_settings_map_.swap(*spdy_settings_map);
}
+void HttpServerPropertiesImpl::InitializePipelineCapabilities(
+ PipelineCapabilityMap* pipeline_capability_map) {
+ PipelineCapabilityMap::const_iterator it;
+ pipeline_capability_map_.Clear();
mmenke 2011/12/02 21:52:10 Whenever we call this, we basically put the pipeli
James Simonsen 2011/12/03 03:16:00 Yeah, I know. :( I debated it for a bit, but decid
mmenke 2011/12/06 15:50:38 Sounds good to me. Just wanted to make sure you w
+ for (it = pipeline_capability_map->begin();
+ it != pipeline_capability_map->end(); ++it) {
+ pipeline_capability_map_.Put(it->first, it->second);
+ }
+}
+
void HttpServerPropertiesImpl::GetSpdyServerList(
base::ListValue* spdy_server_list) const {
DCHECK(CalledOnValidThread());
@@ -94,6 +110,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 +256,41 @@ HttpServerPropertiesImpl::spdy_settings_map() const {
return spdy_settings_map_;
}
+HttpPipelinedHost::Capability HttpServerPropertiesImpl::GetPipelineCapability(
+ const HostPortPair& origin) {
+ HttpPipelinedHost::Capability capability = HttpPipelinedHost::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,
+ HttpPipelinedHost::Capability capability) {
+ CachedPipelineCapabilityMap::iterator it =
+ pipeline_capability_map_.Peek(origin);
+ if (it == pipeline_capability_map_.end() ||
+ it->second != HttpPipelinedHost::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

Powered by Google App Engine
This is Rietveld 408576698