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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5708306c9ff676030429480a48bd276284e60b20 |
--- /dev/null |
+++ b/net/http/http_pipelined_host_pool.cc |
@@ -0,0 +1,48 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/http/http_pipelined_host_pool.h" |
+ |
+#include "base/logging.h" |
+#include "base/stl_util-inl.h" |
+#include "net/http/http_pipelined_host.h" |
+#include "net/http/http_stream_factory.h" |
+ |
+namespace net { |
+ |
+HttpPipelinedHostPool::HttpPipelinedHostPool(HttpStreamFactory* factory) |
+ : factory_(factory) { |
mmenke
2011/08/03 21:09:39
nit: Should be four spaces.
James Simonsen
2011/08/05 01:39:00
Done.
|
+} |
+ |
+HttpPipelinedHostPool::~HttpPipelinedHostPool() { |
+ DCHECK(host_map_.empty()); |
+} |
+ |
+HttpPipelinedHost* HttpPipelinedHostPool::GetPipelinedHost( |
+ const HostPortPair& origin, bool create_if_not_found) { |
+ HostMap::iterator it = host_map_.find(origin); |
+ if (it != host_map_.end()) { |
+ DCHECK(it->second); |
+ return it->second; |
+ } else if (!create_if_not_found) { |
+ return NULL; |
+ } |
+ HttpPipelinedHost* host = new HttpPipelinedHost(this, origin); |
+ host_map_[origin] = host; |
+ return host; |
+} |
+ |
+void HttpPipelinedHostPool::OnHostIdle(HttpPipelinedHost* host) { |
+ const HostPortPair& origin = host->origin(); |
+ DCHECK(ContainsKey(host_map_, origin)); |
+ host_map_.erase(origin); |
+ delete host; |
+} |
+ |
+void HttpPipelinedHostPool::OnHostHasAdditionalCapacity( |
+ HttpPipelinedHost* host) { |
+ factory_->OnHttpPipelinedHostHasAdditionalCapacity(host); |
+} |
+ |
+} // namespace net |