diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-17 19:40:50 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-17 19:40:50 +0000 |
commit | d55ad15d8c3e118d6f03dbf236d6b98c62d66fe9 (patch) | |
tree | cecfa125cafc7e2d86bf5a5fb1d6f75d67753f4d /net/url_request/url_request_http_job.cc | |
parent | e8aa85cde74fd420944f97135361f81a958fe87c (diff) | |
download | chromium_src-d55ad15d8c3e118d6f03dbf236d6b98c62d66fe9.zip chromium_src-d55ad15d8c3e118d6f03dbf236d6b98c62d66fe9.tar.gz chromium_src-d55ad15d8c3e118d6f03dbf236d6b98c62d66fe9.tar.bz2 |
Improve modularity of recent SDCH dictionary load checkin
I felt guilty that I allowed url_request_job to have some logic
in it about whether it can load an SDCH dictinary or not. This
patch pushed the logic back into sdch_manager (where it belongs).
r=wtc
Review URL: http://codereview.chromium.org/20379
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9897 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_http_job.cc')
-rw-r--r-- | net/url_request/url_request_http_job.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index c4d0563..e7e8b20 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -65,7 +65,11 @@ URLRequestHttpJob::URLRequestHttpJob(URLRequest* request) URLRequestHttpJob::~URLRequestHttpJob() { if (sdch_dictionary_url_.is_valid()) { - SdchManager::Global()->FetchDictionary(sdch_dictionary_url_); + // Prior to reaching the destructor, request_ has been set to a NULL + // pointer, so request_->url() is no longer valid in the destructor, and we + // use an alternate copy |request_info_.url|. + SdchManager::Global()->FetchDictionary(request_info_.url, + sdch_dictionary_url_); } } @@ -454,10 +458,11 @@ void URLRequestHttpJob::NotifyHeadersComplete() { // Eventually we should wait until a dictionary is requested several times // 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); - if (SdchManager::Global()->CanFetchDictionary(request_->url(), - dictionary_url)) - sdch_dictionary_url_ = dictionary_url; + // request_->url() won't be valid in the destructor, so we use an + // alternate copy. + DCHECK(request_->url() == request_info_.url); + // Resolve suggested URL relative to request url. + sdch_dictionary_url_ = request_info_.url.Resolve(url_text); } } |