From 7234e6cc82609038c3dbb5bd175e73d7ea93fd76 Mon Sep 17 00:00:00 2001 From: "jar@chromium.org" Date: Wed, 11 Feb 2009 21:37:04 +0000 Subject: Fetch SDCH dictionary as soon as current URL fetch completes Rather than just waiting for 15 seconds, this patch fetches the "suggested dicitionary" as soon as the current download completes. This avoids stealing bandwidth from the original download, but works as quickly as possible to get the dictionary, so that the user can receive compression results asap. r=wtc Review URL: http://codereview.chromium.org/20254 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9597 0039d316-1c4b-4281-b951-d872f2087c98 --- net/url_request/url_request_http_job.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'net/url_request/url_request_http_job.cc') diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index d29b31e..c7fc435 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -64,6 +64,9 @@ URLRequestHttpJob::URLRequestHttpJob(URLRequest* request) } URLRequestHttpJob::~URLRequestHttpJob() { + if (sdch_dictionary_url_.is_valid()) { + SdchManager::Global()->FetchDictionary(sdch_dictionary_url_); + } } void URLRequestHttpJob::SetUpload(net::UploadData* upload) { @@ -445,7 +448,6 @@ void URLRequestHttpJob::NotifyHeadersComplete() { } } - // Get list of SDCH dictionary requests, and schedule them to be loaded. if (SdchManager::Global() && SdchManager::Global()->IsInSupportedDomain(request_->url())) { static const std::string name = "Get-Dictionary"; @@ -459,7 +461,9 @@ void URLRequestHttpJob::NotifyHeadersComplete() { // before we even download it (so that we don't waste memory or bandwidth). if (response_info_->headers->EnumerateHeader(&iter, name, &url_text)) { GURL dictionary_url = request_->url().Resolve(url_text); - SdchManager::Global()->FetchDictionary(request_->url(), dictionary_url); + if (SdchManager::Global()->CanFetchDictionary(request_->url(), + dictionary_url)) + sdch_dictionary_url_ = dictionary_url; } } -- cgit v1.1