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..1138a4ca73027204de3b8c360555434506962740 100644 |
--- a/net/http/http_server_properties_impl.cc |
+++ b/net/http/http_server_properties_impl.cc |
@@ -8,10 +8,17 @@ |
#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 kNumHostsToRemember = 200; |
mmenke
2011/12/06 15:50:38
nit: This should now be kDefaultNumHostsToRemembe
James Simonsen
2011/12/06 19:57:49
Done.
|
+ |
+HttpServerPropertiesImpl::HttpServerPropertiesImpl() |
+ : pipeline_capability_map_(kNumHostsToRemember) { |
} |
HttpServerPropertiesImpl::~HttpServerPropertiesImpl() { |
@@ -48,6 +55,20 @@ 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) { |
mmenke
2011/12/06 15:50:38
Just to make things simple, you could just require
James Simonsen
2011/12/06 19:57:49
Ok. Done.
|
+ pipeline_capability_map_.SetMaxSize(max_size); |
+} |
+ |
void HttpServerPropertiesImpl::GetSpdyServerList( |
base::ListValue* spdy_server_list) const { |
DCHECK(CalledOnValidThread()); |
@@ -94,6 +115,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 +261,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 |