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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 1563163002: Don't pass SDCH GetDictionary event for cached responses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test added Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/url_request/url_request_http_job_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // seen, but rather wait until we can justify their usefulness. 359 // seen, but rather wait until we can justify their usefulness.
360 // For now, we will only fetch the first dictionary, which will at least 360 // For now, we will only fetch the first dictionary, which will at least
361 // require multiple suggestions before we get additional ones for this 361 // require multiple suggestions before we get additional ones for this
362 // site. Eventually we should wait until a dictionary is requested 362 // site. Eventually we should wait until a dictionary is requested
363 // several times 363 // several times
364 // before we even download it (so that we don't waste memory or 364 // before we even download it (so that we don't waste memory or
365 // bandwidth). 365 // bandwidth).
366 if (GetResponseHeaders()->EnumerateHeader(&iter, name, &url_text)) { 366 if (GetResponseHeaders()->EnumerateHeader(&iter, name, &url_text)) {
367 // Resolve suggested URL relative to request url. 367 // Resolve suggested URL relative to request url.
368 GURL sdch_dictionary_url = request_->url().Resolve(url_text); 368 GURL sdch_dictionary_url = request_->url().Resolve(url_text);
369 if (sdch_dictionary_url.is_valid()) { 369 // Don't try to download Dictionary for cached responses. It's either
370 // useless or too late.
371 if (sdch_dictionary_url.is_valid() && !is_cached_content_) {
370 rv = sdch_manager->OnGetDictionary(request_->url(), 372 rv = sdch_manager->OnGetDictionary(request_->url(),
371 sdch_dictionary_url); 373 sdch_dictionary_url);
372 if (rv != SDCH_OK) { 374 if (rv != SDCH_OK) {
373 SdchManager::SdchErrorRecovery(rv); 375 SdchManager::SdchErrorRecovery(rv);
374 request_->net_log().AddEvent( 376 request_->net_log().AddEvent(
375 NetLog::TYPE_SDCH_DICTIONARY_ERROR, 377 NetLog::TYPE_SDCH_DICTIONARY_ERROR,
376 base::Bind(&NetLogSdchDictionaryFetchProblemCallback, rv, 378 base::Bind(&NetLogSdchDictionaryFetchProblemCallback, rv,
377 sdch_dictionary_url, false)); 379 sdch_dictionary_url, false));
378 } 380 }
379 } 381 }
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 return override_response_headers_.get() ? 1612 return override_response_headers_.get() ?
1611 override_response_headers_.get() : 1613 override_response_headers_.get() :
1612 transaction_->GetResponseInfo()->headers.get(); 1614 transaction_->GetResponseInfo()->headers.get();
1613 } 1615 }
1614 1616
1615 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1617 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1616 awaiting_callback_ = false; 1618 awaiting_callback_ = false;
1617 } 1619 }
1618 1620
1619 } // namespace net 1621 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_http_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698