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

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

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « net/url_request/url_request.cc ('k') | net/url_request/url_request_job.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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // Handle the server notification of a new SDCH dictionary. 321 // Handle the server notification of a new SDCH dictionary.
322 SdchManager* sdch_manager(request()->context()->sdch_manager()); 322 SdchManager* sdch_manager(request()->context()->sdch_manager());
323 if (sdch_manager) { 323 if (sdch_manager) {
324 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); 324 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url());
325 if (rv != SDCH_OK) { 325 if (rv != SDCH_OK) {
326 // If SDCH is just disabled, it is not a real error. 326 // If SDCH is just disabled, it is not a real error.
327 if (rv != SDCH_DISABLED && rv != SDCH_SECURE_SCHEME_NOT_SUPPORTED) { 327 if (rv != SDCH_DISABLED && rv != SDCH_SECURE_SCHEME_NOT_SUPPORTED) {
328 SdchManager::SdchErrorRecovery(rv); 328 SdchManager::SdchErrorRecovery(rv);
329 request()->net_log().AddEvent( 329 request()->net_log().AddEvent(
330 NetLog::TYPE_SDCH_DECODING_ERROR, 330 NetLog::TYPE_SDCH_DECODING_ERROR,
331 base::Bind(&NetLogSdchResourceProblemCallback, rv)); 331 base::Bind(NetLogSdchResourceProblemCallback, rv));
332 } 332 }
333 } else { 333 } else {
334 const std::string name = "Get-Dictionary"; 334 const std::string name = "Get-Dictionary";
335 std::string url_text; 335 std::string url_text;
336 void* iter = NULL; 336 void* iter = NULL;
337 // TODO(jar): We need to not fetch dictionaries the first time they are 337 // TODO(jar): We need to not fetch dictionaries the first time they are
338 // seen, but rather wait until we can justify their usefulness. 338 // seen, but rather wait until we can justify their usefulness.
339 // For now, we will only fetch the first dictionary, which will at least 339 // For now, we will only fetch the first dictionary, which will at least
340 // require multiple suggestions before we get additional ones for this 340 // require multiple suggestions before we get additional ones for this
341 // site. Eventually we should wait until a dictionary is requested 341 // site. Eventually we should wait until a dictionary is requested
342 // several times 342 // several times
343 // before we even download it (so that we don't waste memory or 343 // before we even download it (so that we don't waste memory or
344 // bandwidth). 344 // bandwidth).
345 if (GetResponseHeaders()->EnumerateHeader(&iter, name, &url_text)) { 345 if (GetResponseHeaders()->EnumerateHeader(&iter, name, &url_text)) {
346 // Resolve suggested URL relative to request url. 346 // Resolve suggested URL relative to request url.
347 GURL sdch_dictionary_url = request_->url().Resolve(url_text); 347 GURL sdch_dictionary_url = request_->url().Resolve(url_text);
348 if (sdch_dictionary_url.is_valid()) { 348 if (sdch_dictionary_url.is_valid()) {
349 rv = sdch_manager->OnGetDictionary(request_->url(), 349 rv = sdch_manager->OnGetDictionary(request_->url(),
350 sdch_dictionary_url); 350 sdch_dictionary_url);
351 if (rv != SDCH_OK) { 351 if (rv != SDCH_OK) {
352 SdchManager::SdchErrorRecovery(rv); 352 SdchManager::SdchErrorRecovery(rv);
353 request_->net_log().AddEvent( 353 request_->net_log().AddEvent(
354 NetLog::TYPE_SDCH_DICTIONARY_ERROR, 354 NetLog::TYPE_SDCH_DICTIONARY_ERROR,
355 base::Bind(&NetLogSdchDictionaryFetchProblemCallback, rv, 355 base::Bind(NetLogSdchDictionaryFetchProblemCallback, rv,
356 sdch_dictionary_url, false)); 356 sdch_dictionary_url, false));
357 } 357 }
358 } 358 }
359 } 359 }
360 } 360 }
361 } 361 }
362 362
363 // Handle the server signalling no SDCH encoding. 363 // Handle the server signalling no SDCH encoding.
364 if (dictionaries_advertised_) { 364 if (dictionaries_advertised_) {
365 // We are wary of proxies that discard or damage SDCH encoding. If a server 365 // We are wary of proxies that discard or damage SDCH encoding. If a server
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 bool advertise_sdch = sdch_manager != NULL && request()->method() != "POST"; 538 bool advertise_sdch = sdch_manager != NULL && request()->method() != "POST";
539 if (advertise_sdch) { 539 if (advertise_sdch) {
540 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); 540 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url());
541 if (rv != SDCH_OK) { 541 if (rv != SDCH_OK) {
542 advertise_sdch = false; 542 advertise_sdch = false;
543 // If SDCH is just disabled, it is not a real error. 543 // If SDCH is just disabled, it is not a real error.
544 if (rv != SDCH_DISABLED && rv != SDCH_SECURE_SCHEME_NOT_SUPPORTED) { 544 if (rv != SDCH_DISABLED && rv != SDCH_SECURE_SCHEME_NOT_SUPPORTED) {
545 SdchManager::SdchErrorRecovery(rv); 545 SdchManager::SdchErrorRecovery(rv);
546 request()->net_log().AddEvent( 546 request()->net_log().AddEvent(
547 NetLog::TYPE_SDCH_DECODING_ERROR, 547 NetLog::TYPE_SDCH_DECODING_ERROR,
548 base::Bind(&NetLogSdchResourceProblemCallback, rv)); 548 base::Bind(NetLogSdchResourceProblemCallback, rv));
549 } 549 }
550 } 550 }
551 } 551 }
552 if (advertise_sdch) { 552 if (advertise_sdch) {
553 dictionaries_advertised_ = 553 dictionaries_advertised_ =
554 sdch_manager->GetDictionarySet(request_->url()); 554 sdch_manager->GetDictionarySet(request_->url());
555 } 555 }
556 556
557 // The AllowLatencyExperiment() is only true if we've successfully done a 557 // The AllowLatencyExperiment() is only true if we've successfully done a
558 // full SDCH compression recently in this browser session for this host. 558 // full SDCH compression recently in this browser session for this host.
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 return override_response_headers_.get() ? 1516 return override_response_headers_.get() ?
1517 override_response_headers_.get() : 1517 override_response_headers_.get() :
1518 transaction_->GetResponseInfo()->headers.get(); 1518 transaction_->GetResponseInfo()->headers.get();
1519 } 1519 }
1520 1520
1521 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1521 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1522 awaiting_callback_ = false; 1522 awaiting_callback_ = false;
1523 } 1523 }
1524 1524
1525 } // namespace net 1525 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698