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

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

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 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/sdch_dictionary_fetcher.cc ('k') | net/url_request/url_request_http_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.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 12 matching lines...) Expand all
23 #include "net/base/host_port_pair.h" 23 #include "net/base/host_port_pair.h"
24 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
25 #include "net/base/load_timing_info.h" 25 #include "net/base/load_timing_info.h"
26 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
27 #include "net/base/network_change_notifier.h" 27 #include "net/base/network_change_notifier.h"
28 #include "net/base/network_delegate.h" 28 #include "net/base/network_delegate.h"
29 #include "net/base/upload_data_stream.h" 29 #include "net/base/upload_data_stream.h"
30 #include "net/http/http_response_headers.h" 30 #include "net/http/http_response_headers.h"
31 #include "net/http/http_util.h" 31 #include "net/http/http_util.h"
32 #include "net/log/net_log.h" 32 #include "net/log/net_log.h"
33 #include "net/log/net_log_event_type.h"
34 #include "net/log/net_log_source_type.h"
33 #include "net/ssl/ssl_cert_request_info.h" 35 #include "net/ssl/ssl_cert_request_info.h"
34 #include "net/url_request/redirect_info.h" 36 #include "net/url_request/redirect_info.h"
35 #include "net/url_request/url_request_context.h" 37 #include "net/url_request/url_request_context.h"
36 #include "net/url_request/url_request_error_job.h" 38 #include "net/url_request/url_request_error_job.h"
37 #include "net/url_request/url_request_job.h" 39 #include "net/url_request/url_request_job.h"
38 #include "net/url_request/url_request_job_manager.h" 40 #include "net/url_request/url_request_job_manager.h"
39 #include "net/url_request/url_request_netlog_params.h" 41 #include "net/url_request/url_request_netlog_params.h"
40 #include "net/url_request/url_request_redirect_job.h" 42 #include "net/url_request/url_request_redirect_job.h"
41 #include "url/gurl.h" 43 #include "url/gurl.h"
42 #include "url/origin.h" 44 #include "url/origin.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 OrphanJob(); 186 OrphanJob();
185 187
186 int deleted = context_->url_requests()->erase(this); 188 int deleted = context_->url_requests()->erase(this);
187 CHECK_EQ(1, deleted); 189 CHECK_EQ(1, deleted);
188 190
189 int net_error = OK; 191 int net_error = OK;
190 // Log error only on failure, not cancellation, as even successful requests 192 // Log error only on failure, not cancellation, as even successful requests
191 // are "cancelled" on destruction. 193 // are "cancelled" on destruction.
192 if (status_.status() == URLRequestStatus::FAILED) 194 if (status_.status() == URLRequestStatus::FAILED)
193 net_error = status_.error(); 195 net_error = status_.error();
194 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_REQUEST_ALIVE, net_error); 196 net_log_.EndEventWithNetErrorCode(NetLogEventType::REQUEST_ALIVE, net_error);
195 } 197 }
196 198
197 void URLRequest::set_upload(std::unique_ptr<UploadDataStream> upload) { 199 void URLRequest::set_upload(std::unique_ptr<UploadDataStream> upload) {
198 upload_data_stream_ = std::move(upload); 200 upload_data_stream_ = std::move(upload);
199 } 201 }
200 202
201 const UploadDataStream* URLRequest::get_upload() const { 203 const UploadDataStream* URLRequest::get_upload() const {
202 return upload_data_stream_.get(); 204 return upload_data_stream_.get();
203 } 205 }
204 206
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 327
326 // Only log information to NetLog during startup and certain deferring calls 328 // Only log information to NetLog during startup and certain deferring calls
327 // to delegates. For all reads but the first, do nothing. 329 // to delegates. For all reads but the first, do nothing.
328 if (!calling_delegate_ && !response_info_.request_time.is_null()) 330 if (!calling_delegate_ && !response_info_.request_time.is_null())
329 return; 331 return;
330 332
331 LogUnblocked(); 333 LogUnblocked();
332 blocked_by_ = blocked_by; 334 blocked_by_ = blocked_by;
333 use_blocked_by_as_load_param_ = false; 335 use_blocked_by_as_load_param_ = false;
334 336
335 net_log_.BeginEvent( 337 net_log_.BeginEvent(NetLogEventType::DELEGATE_INFO,
336 NetLog::TYPE_DELEGATE_INFO, 338 NetLog::StringCallback("delegate_info", &blocked_by_));
337 NetLog::StringCallback("delegate_info", &blocked_by_));
338 } 339 }
339 340
340 void URLRequest::LogAndReportBlockedBy(const char* source) { 341 void URLRequest::LogAndReportBlockedBy(const char* source) {
341 LogBlockedBy(source); 342 LogBlockedBy(source);
342 use_blocked_by_as_load_param_ = true; 343 use_blocked_by_as_load_param_ = true;
343 } 344 }
344 345
345 void URLRequest::LogUnblocked() { 346 void URLRequest::LogUnblocked() {
346 if (blocked_by_.empty()) 347 if (blocked_by_.empty())
347 return; 348 return;
348 349
349 net_log_.EndEvent(NetLog::TYPE_DELEGATE_INFO); 350 net_log_.EndEvent(NetLogEventType::DELEGATE_INFO);
350 blocked_by_.clear(); 351 blocked_by_.clear();
351 } 352 }
352 353
353 UploadProgress URLRequest::GetUploadProgress() const { 354 UploadProgress URLRequest::GetUploadProgress() const {
354 if (!job_.get()) { 355 if (!job_.get()) {
355 // We haven't started or the request was cancelled 356 // We haven't started or the request was cancelled
356 return UploadProgress(); 357 return UploadProgress();
357 } 358 }
358 if (final_upload_progress_.position()) { 359 if (final_upload_progress_.position()) {
359 // The first job completed and none of the subsequent series of 360 // The first job completed and none of the subsequent series of
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 554
554 URLRequest::URLRequest(const GURL& url, 555 URLRequest::URLRequest(const GURL& url,
555 RequestPriority priority, 556 RequestPriority priority,
556 Delegate* delegate, 557 Delegate* delegate,
557 const URLRequestContext* context, 558 const URLRequestContext* context,
558 NetworkDelegate* network_delegate) 559 NetworkDelegate* network_delegate)
559 : context_(context), 560 : context_(context),
560 network_delegate_(network_delegate ? network_delegate 561 network_delegate_(network_delegate ? network_delegate
561 : context->network_delegate()), 562 : context->network_delegate()),
562 net_log_( 563 net_log_(
563 BoundNetLog::Make(context->net_log(), NetLog::SOURCE_URL_REQUEST)), 564 BoundNetLog::Make(context->net_log(), NetLogSourceType::URL_REQUEST)),
564 url_chain_(1, url), 565 url_chain_(1, url),
565 method_("GET"), 566 method_("GET"),
566 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 567 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
567 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), 568 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL),
568 load_flags_(LOAD_NORMAL), 569 load_flags_(LOAD_NORMAL),
569 delegate_(delegate), 570 delegate_(delegate),
570 status_(URLRequestStatus::FromError(OK)), 571 status_(URLRequestStatus::FromError(OK)),
571 is_pending_(false), 572 is_pending_(false),
572 is_redirecting_(false), 573 is_redirecting_(false),
573 redirect_limit_(kMaxRedirects), 574 redirect_limit_(kMaxRedirects),
574 priority_(priority), 575 priority_(priority),
575 identifier_(GenerateURLRequestIdentifier()), 576 identifier_(GenerateURLRequestIdentifier()),
576 calling_delegate_(false), 577 calling_delegate_(false),
577 use_blocked_by_as_load_param_(false), 578 use_blocked_by_as_load_param_(false),
578 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 579 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
579 base::Unretained(this))), 580 base::Unretained(this))),
580 has_notified_completion_(false), 581 has_notified_completion_(false),
581 received_response_content_length_(0), 582 received_response_content_length_(0),
582 creation_time_(base::TimeTicks::Now()) { 583 creation_time_(base::TimeTicks::Now()) {
583 // Sanity check out environment. 584 // Sanity check out environment.
584 DCHECK(base::MessageLoop::current()) 585 DCHECK(base::MessageLoop::current())
585 << "The current base::MessageLoop must exist"; 586 << "The current base::MessageLoop must exist";
586 587
587 context->url_requests()->insert(this); 588 context->url_requests()->insert(this);
588 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); 589 net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE);
589 } 590 }
590 591
591 void URLRequest::BeforeRequestComplete(int error) { 592 void URLRequest::BeforeRequestComplete(int error) {
592 DCHECK(!job_.get()); 593 DCHECK(!job_.get());
593 DCHECK_NE(ERR_IO_PENDING, error); 594 DCHECK_NE(ERR_IO_PENDING, error);
594 595
595 // Check that there are no callbacks to already canceled requests. 596 // Check that there are no callbacks to already canceled requests.
596 DCHECK_NE(URLRequestStatus::CANCELED, status_.status()); 597 DCHECK_NE(URLRequestStatus::CANCELED, status_.status());
597 598
598 OnCallToDelegateComplete(); 599 OnCallToDelegateComplete();
599 600
600 if (error != OK) { 601 if (error != OK) {
601 std::string source("delegate"); 602 std::string source("delegate");
602 net_log_.AddEvent(NetLog::TYPE_CANCELLED, 603 net_log_.AddEvent(NetLogEventType::CANCELLED,
603 NetLog::StringCallback("source", &source)); 604 NetLog::StringCallback("source", &source));
604 StartJob(new URLRequestErrorJob(this, network_delegate_, error)); 605 StartJob(new URLRequestErrorJob(this, network_delegate_, error));
605 } else if (!delegate_redirect_url_.is_empty()) { 606 } else if (!delegate_redirect_url_.is_empty()) {
606 GURL new_url; 607 GURL new_url;
607 new_url.Swap(&delegate_redirect_url_); 608 new_url.Swap(&delegate_redirect_url_);
608 609
609 URLRequestRedirectJob* job = new URLRequestRedirectJob( 610 URLRequestRedirectJob* job = new URLRequestRedirectJob(
610 this, network_delegate_, new_url, 611 this, network_delegate_, new_url,
611 // Use status code 307 to preserve the method, so POST requests work. 612 // Use status code 307 to preserve the method, so POST requests work.
612 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Delegate"); 613 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Delegate");
613 StartJob(job); 614 StartJob(job);
614 } else { 615 } else {
615 StartJob(URLRequestJobManager::GetInstance()->CreateJob( 616 StartJob(URLRequestJobManager::GetInstance()->CreateJob(
616 this, network_delegate_)); 617 this, network_delegate_));
617 } 618 }
618 } 619 }
619 620
620 void URLRequest::StartJob(URLRequestJob* job) { 621 void URLRequest::StartJob(URLRequestJob* job) {
621 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. 622 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
622 tracked_objects::ScopedTracker tracking_profile( 623 tracked_objects::ScopedTracker tracking_profile(
623 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::StartJob")); 624 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::StartJob"));
624 625
625 DCHECK(!is_pending_); 626 DCHECK(!is_pending_);
626 DCHECK(!job_.get()); 627 DCHECK(!job_.get());
627 628
628 net_log_.BeginEvent( 629 net_log_.BeginEvent(
629 NetLog::TYPE_URL_REQUEST_START_JOB, 630 NetLogEventType::URL_REQUEST_START_JOB,
630 base::Bind(&NetLogURLRequestStartCallback, 631 base::Bind(&NetLogURLRequestStartCallback, &url(), &method_, load_flags_,
631 &url(), &method_, load_flags_, priority_, 632 priority_,
632 upload_data_stream_ ? upload_data_stream_->identifier() : -1)); 633 upload_data_stream_ ? upload_data_stream_->identifier() : -1));
633 634
634 job_.reset(job); 635 job_.reset(job);
635 job_->SetExtraRequestHeaders(extra_request_headers_); 636 job_->SetExtraRequestHeaders(extra_request_headers_);
636 job_->SetPriority(priority_); 637 job_->SetPriority(priority_);
637 638
638 if (upload_data_stream_.get()) 639 if (upload_data_stream_.get())
639 job_->SetUpload(upload_data_stream_.get()); 640 job_->SetUpload(upload_data_stream_.get());
640 641
641 is_pending_ = true; 642 is_pending_ = true;
642 is_redirecting_ = false; 643 is_redirecting_ = false;
643 644
644 response_info_.was_cached = false; 645 response_info_.was_cached = false;
645 646
646 if (GURL(referrer_) != URLRequestJob::ComputeReferrerForRedirect( 647 if (GURL(referrer_) != URLRequestJob::ComputeReferrerForRedirect(
647 referrer_policy_, referrer_, url())) { 648 referrer_policy_, referrer_, url())) {
648 if (!network_delegate_ || 649 if (!network_delegate_ ||
649 !network_delegate_->CancelURLRequestWithPolicyViolatingReferrerHeader( 650 !network_delegate_->CancelURLRequestWithPolicyViolatingReferrerHeader(
650 *this, url(), GURL(referrer_))) { 651 *this, url(), GURL(referrer_))) {
651 referrer_.clear(); 652 referrer_.clear();
652 } else { 653 } else {
653 // We need to clear the referrer anyway to avoid an infinite recursion 654 // We need to clear the referrer anyway to avoid an infinite recursion
654 // when starting the error job. 655 // when starting the error job.
655 referrer_.clear(); 656 referrer_.clear();
656 std::string source("delegate"); 657 std::string source("delegate");
657 net_log_.AddEvent(NetLog::TYPE_CANCELLED, 658 net_log_.AddEvent(NetLogEventType::CANCELLED,
658 NetLog::StringCallback("source", &source)); 659 NetLog::StringCallback("source", &source));
659 RestartWithJob(new URLRequestErrorJob( 660 RestartWithJob(new URLRequestErrorJob(
660 this, network_delegate_, ERR_BLOCKED_BY_CLIENT)); 661 this, network_delegate_, ERR_BLOCKED_BY_CLIENT));
661 return; 662 return;
662 } 663 }
663 } 664 }
664 665
665 // Start() always completes asynchronously. 666 // Start() always completes asynchronously.
666 // 667 //
667 // Status is generally set by URLRequestJob itself, but Start() calls 668 // Status is generally set by URLRequestJob itself, but Start() calls
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 713
713 // If the URL request already has an error status, then canceling is a no-op. 714 // If the URL request already has an error status, then canceling is a no-op.
714 // Plus, we don't want to change the error status once it has been set. 715 // Plus, we don't want to change the error status once it has been set.
715 if (status_.is_success()) { 716 if (status_.is_success()) {
716 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); 717 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error);
717 response_info_.ssl_info = ssl_info; 718 response_info_.ssl_info = ssl_info;
718 719
719 // If the request hasn't already been completed, log a cancellation event. 720 // If the request hasn't already been completed, log a cancellation event.
720 if (!has_notified_completion_) { 721 if (!has_notified_completion_) {
721 // Don't log an error code on ERR_ABORTED, since that's redundant. 722 // Don't log an error code on ERR_ABORTED, since that's redundant.
722 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_CANCELLED, 723 net_log_.AddEventWithNetErrorCode(NetLogEventType::CANCELLED,
723 error == ERR_ABORTED ? OK : error); 724 error == ERR_ABORTED ? OK : error);
724 } 725 }
725 } 726 }
726 727
727 if (is_pending_ && job_.get()) 728 if (is_pending_ && job_.get())
728 job_->Kill(); 729 job_->Kill();
729 730
730 // We need to notify about the end of this job here synchronously. The 731 // We need to notify about the end of this job here synchronously. The
731 // Job sends an asynchronous notification but by the time this is processed, 732 // Job sends an asynchronous notification but by the time this is processed,
732 // our |context_| is NULL. 733 // our |context_| is NULL.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 821 }
821 822
822 void URLRequest::NotifyResponseStarted(const URLRequestStatus& status) { 823 void URLRequest::NotifyResponseStarted(const URLRequestStatus& status) {
823 // Change status if there was an error. 824 // Change status if there was an error.
824 if (status.status() != URLRequestStatus::SUCCESS) 825 if (status.status() != URLRequestStatus::SUCCESS)
825 set_status(status); 826 set_status(status);
826 827
827 int net_error = OK; 828 int net_error = OK;
828 if (!status_.is_success()) 829 if (!status_.is_success())
829 net_error = status_.error(); 830 net_error = status_.error();
830 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_URL_REQUEST_START_JOB, 831 net_log_.EndEventWithNetErrorCode(NetLogEventType::URL_REQUEST_START_JOB,
831 net_error); 832 net_error);
832 833
833 URLRequestJob* job = 834 URLRequestJob* job =
834 URLRequestJobManager::GetInstance()->MaybeInterceptResponse( 835 URLRequestJobManager::GetInstance()->MaybeInterceptResponse(
835 this, network_delegate_); 836 this, network_delegate_);
836 if (job) { 837 if (job) {
837 RestartWithJob(job); 838 RestartWithJob(job);
838 } else { 839 } else {
839 // In some cases (e.g. an event was canceled), we might have sent the 840 // In some cases (e.g. an event was canceled), we might have sent the
840 // completion event and receive a NotifyResponseStarted() later. 841 // completion event and receive a NotifyResponseStarted() later.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 898
898 status_ = URLRequestStatus::FromError(ERR_IO_PENDING); 899 status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
899 job_->ContinueDespiteLastError(); 900 job_->ContinueDespiteLastError();
900 } 901 }
901 902
902 void URLRequest::PrepareToRestart() { 903 void URLRequest::PrepareToRestart() {
903 DCHECK(job_.get()); 904 DCHECK(job_.get());
904 905
905 // Close the current URL_REQUEST_START_JOB, since we will be starting a new 906 // Close the current URL_REQUEST_START_JOB, since we will be starting a new
906 // one. 907 // one.
907 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_START_JOB); 908 net_log_.EndEvent(NetLogEventType::URL_REQUEST_START_JOB);
908 909
909 OrphanJob(); 910 OrphanJob();
910 911
911 response_info_ = HttpResponseInfo(); 912 response_info_ = HttpResponseInfo();
912 response_info_.request_time = base::Time::Now(); 913 response_info_.request_time = base::Time::Now();
913 914
914 load_timing_info_ = LoadTimingInfo(); 915 load_timing_info_ = LoadTimingInfo();
915 load_timing_info_.request_start_time = response_info_.request_time; 916 load_timing_info_.request_start_time = response_info_.request_time;
916 load_timing_info_.request_start = base::TimeTicks::Now(); 917 load_timing_info_.request_start = base::TimeTicks::Now();
917 918
(...skipping 13 matching lines...) Expand all
931 // that the callback becomes invalid. 932 // that the callback becomes invalid.
932 job_->Kill(); 933 job_->Kill();
933 job_ = NULL; 934 job_ = NULL;
934 } 935 }
935 936
936 int URLRequest::Redirect(const RedirectInfo& redirect_info) { 937 int URLRequest::Redirect(const RedirectInfo& redirect_info) {
937 // Matches call in NotifyReceivedRedirect. 938 // Matches call in NotifyReceivedRedirect.
938 OnCallToDelegateComplete(); 939 OnCallToDelegateComplete();
939 if (net_log_.IsCapturing()) { 940 if (net_log_.IsCapturing()) {
940 net_log_.AddEvent( 941 net_log_.AddEvent(
941 NetLog::TYPE_URL_REQUEST_REDIRECTED, 942 NetLogEventType::URL_REQUEST_REDIRECTED,
942 NetLog::StringCallback("location", 943 NetLog::StringCallback("location",
943 &redirect_info.new_url.possibly_invalid_spec())); 944 &redirect_info.new_url.possibly_invalid_spec()));
944 } 945 }
945 946
946 // TODO(davidben): Pass the full RedirectInfo to the NetworkDelegate. 947 // TODO(davidben): Pass the full RedirectInfo to the NetworkDelegate.
947 if (network_delegate_) 948 if (network_delegate_)
948 network_delegate_->NotifyBeforeRedirect(this, redirect_info.new_url); 949 network_delegate_->NotifyBeforeRedirect(this, redirect_info.new_url);
949 950
950 if (redirect_limit_ <= 0) { 951 if (redirect_limit_ <= 0) {
951 DVLOG(1) << "disallowing redirect: exceeds limit"; 952 DVLOG(1) << "disallowing redirect: exceeds limit";
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 // have MAXIMUM_PRIORITY for release mode. 1040 // have MAXIMUM_PRIORITY for release mode.
1040 return; 1041 return;
1041 } 1042 }
1042 1043
1043 if (priority_ == priority) 1044 if (priority_ == priority)
1044 return; 1045 return;
1045 1046
1046 priority_ = priority; 1047 priority_ = priority;
1047 if (job_.get()) { 1048 if (job_.get()) {
1048 net_log_.AddEvent( 1049 net_log_.AddEvent(
1049 NetLog::TYPE_URL_REQUEST_SET_PRIORITY, 1050 NetLogEventType::URL_REQUEST_SET_PRIORITY,
1050 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); 1051 NetLog::StringCallback("priority", RequestPriorityToString(priority_)));
1051 job_->SetPriority(priority_); 1052 job_->SetPriority(priority_);
1052 } 1053 }
1053 } 1054 }
1054 1055
1055 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { 1056 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) {
1056 NetworkDelegate::AuthRequiredResponse rv = 1057 NetworkDelegate::AuthRequiredResponse rv =
1057 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; 1058 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
1058 auth_info_ = auth_info; 1059 auth_info_ = auth_info;
1059 if (network_delegate_) { 1060 if (network_delegate_) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 has_notified_completion_ = true; 1208 has_notified_completion_ = true;
1208 if (network_delegate_) 1209 if (network_delegate_)
1209 network_delegate_->NotifyCompleted(this, job_.get() != NULL, 1210 network_delegate_->NotifyCompleted(this, job_.get() != NULL,
1210 status_.error()); 1211 status_.error());
1211 } 1212 }
1212 1213
1213 void URLRequest::OnCallToDelegate() { 1214 void URLRequest::OnCallToDelegate() {
1214 DCHECK(!calling_delegate_); 1215 DCHECK(!calling_delegate_);
1215 DCHECK(blocked_by_.empty()); 1216 DCHECK(blocked_by_.empty());
1216 calling_delegate_ = true; 1217 calling_delegate_ = true;
1217 net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_DELEGATE); 1218 net_log_.BeginEvent(NetLogEventType::URL_REQUEST_DELEGATE);
1218 } 1219 }
1219 1220
1220 void URLRequest::OnCallToDelegateComplete() { 1221 void URLRequest::OnCallToDelegateComplete() {
1221 // This should have been cleared before resuming the request. 1222 // This should have been cleared before resuming the request.
1222 DCHECK(blocked_by_.empty()); 1223 DCHECK(blocked_by_.empty());
1223 if (!calling_delegate_) 1224 if (!calling_delegate_)
1224 return; 1225 return;
1225 calling_delegate_ = false; 1226 calling_delegate_ = false;
1226 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_DELEGATE); 1227 net_log_.EndEvent(NetLogEventType::URL_REQUEST_DELEGATE);
1227 } 1228 }
1228 1229
1229 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1230 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1230 if (job_) 1231 if (job_)
1231 job_->GetConnectionAttempts(out); 1232 job_->GetConnectionAttempts(out);
1232 else 1233 else
1233 out->clear(); 1234 out->clear();
1234 } 1235 }
1235 1236
1236 void URLRequest::set_status(URLRequestStatus status) { 1237 void URLRequest::set_status(URLRequestStatus status) {
1237 DCHECK(status_.is_io_pending() || status_.is_success() || 1238 DCHECK(status_.is_io_pending() || status_.is_success() ||
1238 (!status.is_success() && !status.is_io_pending())); 1239 (!status.is_success() && !status.is_io_pending()));
1239 status_ = status; 1240 status_ = status;
1240 } 1241 }
1241 1242
1242 } // namespace net 1243 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/sdch_dictionary_fetcher.cc ('k') | net/url_request/url_request_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698