diff options
author | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 01:18:55 +0000 |
---|---|---|
committer | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 01:18:55 +0000 |
commit | 7a9c86180d397bab57899cde12c598760cb34b47 (patch) | |
tree | 3715eb0f711e7918a37e03827936d3e72da01b7f /net/http | |
parent | b6e4beca3a071606c537af2d55eba21d99769cb0 (diff) | |
download | chromium_src-7a9c86180d397bab57899cde12c598760cb34b47.zip chromium_src-7a9c86180d397bab57899cde12c598760cb34b47.tar.gz chromium_src-7a9c86180d397bab57899cde12c598760cb34b47.tar.bz2 |
Notify the WinHttpRequestThrottle of the completion of a
request when we have read the entire response, rather than
waiting until the destructor. This is what we do in the
new HTTP stack (see HttpNetworkTransaction::DoReadBodyComplete).
This allows us to unblock the queued requests in the
WinHttpRequestThrottle sooner.
After this change, the name of the request_submitted_
member is no longer accurate. Since we'll replace the
WinHTTP code soon, I just update the comment rather than
renaming the member.
R=darin
BUG=4302
Review URL: http://codereview.chromium.org/10613
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_transaction_winhttp.cc | 10 | ||||
-rw-r--r-- | net/http/http_transaction_winhttp.h | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/net/http/http_transaction_winhttp.cc b/net/http/http_transaction_winhttp.cc index 4429511..727bbe3 100644 --- a/net/http/http_transaction_winhttp.cc +++ b/net/http/http_transaction_winhttp.cc @@ -727,7 +727,7 @@ void HttpTransactionWinHttp::StatusCallback(HINTERNET handle, // Successfully found the IP address of the server. case WINHTTP_CALLBACK_STATUS_NAME_RESOLVED: DidFinishDnsResolutionWithStatus(true, - GURL(), // null referer URL. + GURL(), // null referrer URL. reinterpret_cast<void*>(context)); break; } @@ -1435,6 +1435,14 @@ int HttpTransactionWinHttp::DidReadData(DWORD num_bytes) { content_length_remaining_ = 0; } + // We have read the entire response. Mark the request done to unblock a + // queued request. + if (rv == 0 || content_length_remaining_ == 0) { + DCHECK(request_submitted_); + request_submitted_ = false; + session_->request_throttle()->NotifyRequestDone(connect_peer_); + } + return rv; } diff --git a/net/http/http_transaction_winhttp.h b/net/http/http_transaction_winhttp.h index 430a288..5bb3b94 100644 --- a/net/http/http_transaction_winhttp.h +++ b/net/http/http_transaction_winhttp.h @@ -185,7 +185,8 @@ class HttpTransactionWinHttp : public HttpTransaction { // worry about thread synchronization issues.) bool need_to_wait_for_handle_closing_; - // True if we have called WinHttpRequestThrottle::SubmitRequest. + // True if we have called WinHttpRequestThrottle::SubmitRequest but haven't + // called WinHttpRequestThrottle::NotifyRequestDone. bool request_submitted_; DISALLOW_EVIL_CONSTRUCTORS(HttpTransactionWinHttp); |