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

Unified Diff: net/http/http_pipelined_host_pool.cc

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added about:flags entry Created 9 years, 5 months 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_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

Powered by Google App Engine
This is Rietveld 408576698