diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-16 00:49:00 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-16 00:49:00 +0000 |
commit | 81cdfcd5d551d8d581952a27ae968803ad856a39 (patch) | |
tree | 6f3806fb275ea36dddd43bd9d6efff96a93a2c77 /net/http/http_stream_factory.cc | |
parent | d770c84f903bd2058e33c6635c553f22c455efd3 (diff) | |
download | chromium_src-81cdfcd5d551d8d581952a27ae968803ad856a39.zip chromium_src-81cdfcd5d551d8d581952a27ae968803ad856a39.tar.gz chromium_src-81cdfcd5d551d8d581952a27ae968803ad856a39.tar.bz2 |
Plumb up the preconnect logic from pools to StreamFactory.
BUG=54450
TEST=none
Review URL: http://codereview.chromium.org/3750009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_factory.cc')
-rw-r--r-- | net/http/http_stream_factory.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc index 9342564..1ddd1c2 100644 --- a/net/http/http_stream_factory.cc +++ b/net/http/http_stream_factory.cc @@ -42,6 +42,13 @@ HttpStreamFactory::HttpStreamFactory() { } HttpStreamFactory::~HttpStreamFactory() { + RequestCallbackMap request_callback_map; + request_callback_map.swap(request_callback_map_); + for (RequestCallbackMap::iterator it = request_callback_map.begin(); + it != request_callback_map.end(); ++it) { + delete it->first; + // We don't invoke the callback in the destructor. + } } StreamRequest* HttpStreamFactory::RequestStream( @@ -56,6 +63,22 @@ StreamRequest* HttpStreamFactory::RequestStream( return stream; } +int HttpStreamFactory::PreconnectStreams( + int num_streams, + const HttpRequestInfo* request_info, + SSLConfig* ssl_config, + ProxyInfo* proxy_info, + HttpNetworkSession* session, + const BoundNetLog& net_log, + CompletionCallback* callback) { + HttpStreamRequest* stream = new HttpStreamRequest(this, session); + int rv = stream->Preconnect(num_streams, request_info, ssl_config, + proxy_info, this, net_log); + DCHECK_EQ(ERR_IO_PENDING, rv); + request_callback_map_[stream] = callback; + return rv; +} + void HttpStreamFactory::AddTLSIntolerantServer(const GURL& url) { tls_intolerant_servers_.insert(GetHostAndPort(url)); } @@ -131,4 +154,14 @@ GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, return url; } +void HttpStreamFactory::OnPreconnectsComplete( + HttpStreamRequest* request, int result) { + RequestCallbackMap::iterator it = request_callback_map_.find(request); + DCHECK(it != request_callback_map_.end()); + CompletionCallback* callback = it->second; + request_callback_map_.erase(it); + delete request; + callback->Run(result); +} + } // namespace net |