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

Unified Diff: net/http/http_stream_factory_impl_request.cc

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit tests Created 9 years, 4 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_stream_factory_impl_request.cc
diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc
index a97f46eb0cbe605f2f77976f47cc03e7b5061037..7f2a575997843fb4fad92e996174893509399895 100644
--- a/net/http/http_stream_factory_impl_request.cc
+++ b/net/http/http_stream_factory_impl_request.cc
@@ -43,6 +43,7 @@ HttpStreamFactoryImpl::Request::~Request() {
STLDeleteElements(&jobs_);
RemoveRequestFromSpdySessionRequestMap();
+ RemoveRequestFromHttpPipeliningRequestMap();
}
void HttpStreamFactoryImpl::Request::SetSpdySessionKey(
@@ -55,6 +56,16 @@ void HttpStreamFactoryImpl::Request::SetSpdySessionKey(
request_set.insert(this);
}
+void HttpStreamFactoryImpl::Request::SetHttpPipeliningKey(
+ const HostPortPair& http_pipelining_key) {
+ DCHECK(!http_pipelining_key_.get());
+ http_pipelining_key_.reset(new HostPortPair(http_pipelining_key));
+ RequestSet& request_set =
+ factory_->http_pipelining_request_map_[http_pipelining_key];
+ DCHECK(!ContainsKey(request_set, this));
+ request_set.insert(this);
+}
+
void HttpStreamFactoryImpl::Request::AttachJob(Job* job) {
DCHECK(job);
jobs_.insert(job);
@@ -84,7 +95,8 @@ void HttpStreamFactoryImpl::Request::OnStreamReady(
DCHECK(completed_);
// |job| should only be NULL if we're being serviced by a late bound
- // SpdySession (one that was not created by a job in our |jobs_| set).
+ // SpdySession or HttpPipelinedConnection (one that was not created by a job
+ // in our |jobs_| set).
if (!job) {
DCHECK(!bound_job_.get());
DCHECK(!jobs_.empty());
@@ -225,6 +237,22 @@ HttpStreamFactoryImpl::Request::RemoveRequestFromSpdySessionRequestMap() {
}
}
+void
+HttpStreamFactoryImpl::Request::RemoveRequestFromHttpPipeliningRequestMap() {
+ if (http_pipelining_key_.get()) {
+ HttpPipeliningRequestMap& http_pipelining_request_map =
+ factory_->http_pipelining_request_map_;
+ DCHECK(ContainsKey(http_pipelining_request_map, *http_pipelining_key_));
+ RequestSet& request_set =
+ http_pipelining_request_map[*http_pipelining_key_];
+ DCHECK(ContainsKey(request_set, this));
+ request_set.erase(this);
+ if (request_set.empty())
+ http_pipelining_request_map.erase(*http_pipelining_key_);
+ http_pipelining_key_.reset();
+ }
+}
+
void HttpStreamFactoryImpl::Request::OnSpdySessionReady(
Job* job,
scoped_refptr<SpdySession> spdy_session,
@@ -278,6 +306,7 @@ void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) {
void HttpStreamFactoryImpl::Request::OrphanJobs() {
RemoveRequestFromSpdySessionRequestMap();
+ RemoveRequestFromHttpPipeliningRequestMap();
std::set<Job*> tmp;
tmp.swap(jobs_);

Powered by Google App Engine
This is Rietveld 408576698