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

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: 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
336 NetLog::TYPE_DELEGATE_INFO, 338 NetLogEventType::DELEGATE_INFO,
337 NetLog::StringCallback("delegate_info", &blocked_by_)); 339 NetLog::StringCallback("delegate_info", &blocked_by_));
338 } 340 }
339 341
340 void URLRequest::LogAndReportBlockedBy(const char* source) { 342 void URLRequest::LogAndReportBlockedBy(const char* source) {
341 LogBlockedBy(source); 343 LogBlockedBy(source);
342 use_blocked_by_as_load_param_ = true; 344 use_blocked_by_as_load_param_ = true;
343 } 345 }
344 346
345 void URLRequest::LogUnblocked() { 347 void URLRequest::LogUnblocked() {
346 if (blocked_by_.empty()) 348 if (blocked_by_.empty())
347 return; 349 return;
348 350
349 net_log_.EndEvent(NetLog::TYPE_DELEGATE_INFO); 351 net_log_.EndEvent(NetLogEventType::DELEGATE_INFO);
350 blocked_by_.clear(); 352 blocked_by_.clear();
351 } 353 }
352 354
353 UploadProgress URLRequest::GetUploadProgress() const { 355 UploadProgress URLRequest::GetUploadProgress() const {
354 if (!job_.get()) { 356 if (!job_.get()) {
355 // We haven't started or the request was cancelled 357 // We haven't started or the request was cancelled
356 return UploadProgress(); 358 return UploadProgress();
357 } 359 }
358 if (final_upload_progress_.position()) { 360 if (final_upload_progress_.position()) {
359 // The first job completed and none of the subsequent series of 361 // The first job completed and none of the subsequent series of
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 555
554 URLRequest::URLRequest(const GURL& url, 556 URLRequest::URLRequest(const GURL& url,
555 RequestPriority priority, 557 RequestPriority priority,
556 Delegate* delegate, 558 Delegate* delegate,
557 const URLRequestContext* context, 559 const URLRequestContext* context,
558 NetworkDelegate* network_delegate) 560 NetworkDelegate* network_delegate)
559 : context_(context), 561 : context_(context),
560 network_delegate_(network_delegate ? network_delegate 562 network_delegate_(network_delegate ? network_delegate
561 : context->network_delegate()), 563 : context->network_delegate()),
562 net_log_( 564 net_log_(
563 BoundNetLog::Make(context->net_log(), NetLog::SOURCE_URL_REQUEST)), 565 BoundNetLog::Make(context->net_log(), NetLogSourceType::URL_REQUEST)),
564 url_chain_(1, url), 566 url_chain_(1, url),
565 method_("GET"), 567 method_("GET"),
566 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 568 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
567 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), 569 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL),
568 load_flags_(LOAD_NORMAL), 570 load_flags_(LOAD_NORMAL),
569 delegate_(delegate), 571 delegate_(delegate),
570 status_(URLRequestStatus::FromError(OK)), 572 status_(URLRequestStatus::FromError(OK)),
571 is_pending_(false), 573 is_pending_(false),
572 is_redirecting_(false), 574 is_redirecting_(false),
573 redirect_limit_(kMaxRedirects), 575 redirect_limit_(kMaxRedirects),
574 priority_(priority), 576 priority_(priority),
575 identifier_(GenerateURLRequestIdentifier()), 577 identifier_(GenerateURLRequestIdentifier()),
576 calling_delegate_(false), 578 calling_delegate_(false),
577 use_blocked_by_as_load_param_(false), 579 use_blocked_by_as_load_param_(false),
578 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 580 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
579 base::Unretained(this))), 581 base::Unretained(this))),
580 has_notified_completion_(false), 582 has_notified_completion_(false),
581 received_response_content_length_(0), 583 received_response_content_length_(0),
582 creation_time_(base::TimeTicks::Now()) { 584 creation_time_(base::TimeTicks::Now()) {
583 // Sanity check out environment. 585 // Sanity check out environment.
584 DCHECK(base::MessageLoop::current()) 586 DCHECK(base::MessageLoop::current())
585 << "The current base::MessageLoop must exist"; 587 << "The current base::MessageLoop must exist";
586 588
587 context->url_requests()->insert(this); 589 context->url_requests()->insert(this);
588 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); 590 net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE);
589 } 591 }
590 592
591 void URLRequest::BeforeRequestComplete(int error) { 593 void URLRequest::BeforeRequestComplete(int error) {
592 DCHECK(!job_.get()); 594 DCHECK(!job_.get());
593 DCHECK_NE(ERR_IO_PENDING, error); 595 DCHECK_NE(ERR_IO_PENDING, error);
594 596
595 // Check that there are no callbacks to already canceled requests. 597 // Check that there are no callbacks to already canceled requests.
596 DCHECK_NE(URLRequestStatus::CANCELED, status_.status()); 598 DCHECK_NE(URLRequestStatus::CANCELED, status_.status());
597 599
598 OnCallToDelegateComplete(); 600 OnCallToDelegateComplete();
599 601
600 if (error != OK) { 602 if (error != OK) {
601 std::string source("delegate"); 603 std::string source("delegate");
602 net_log_.AddEvent(NetLog::TYPE_CANCELLED, 604 net_log_.AddEvent(NetLogEventType::CANCELLED,
603 NetLog::StringCallback("source", &source)); 605 NetLog::StringCallback("source", &source));
604 StartJob(new URLRequestErrorJob(this, network_delegate_, error)); 606 StartJob(new URLRequestErrorJob(this, network_delegate_, error));
605 } else if (!delegate_redirect_url_.is_empty()) { 607 } else if (!delegate_redirect_url_.is_empty()) {
606 GURL new_url; 608 GURL new_url;
607 new_url.Swap(&delegate_redirect_url_); 609 new_url.Swap(&delegate_redirect_url_);
608 610
609 URLRequestRedirectJob* job = new URLRequestRedirectJob( 611 URLRequestRedirectJob* job = new URLRequestRedirectJob(
610 this, network_delegate_, new_url, 612 this, network_delegate_, new_url,
611 // Use status code 307 to preserve the method, so POST requests work. 613 // Use status code 307 to preserve the method, so POST requests work.
612 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Delegate"); 614 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Delegate");
613 StartJob(job); 615 StartJob(job);
614 } else { 616 } else {
615 StartJob(URLRequestJobManager::GetInstance()->CreateJob( 617 StartJob(URLRequestJobManager::GetInstance()->CreateJob(
616 this, network_delegate_)); 618 this, network_delegate_));
617 } 619 }
618 } 620 }
619 621
620 void URLRequest::StartJob(URLRequestJob* job) { 622 void URLRequest::StartJob(URLRequestJob* job) {
621 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. 623 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
622 tracked_objects::ScopedTracker tracking_profile( 624 tracked_objects::ScopedTracker tracking_profile(
623 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::StartJob")); 625 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::StartJob"));
624 626
625 DCHECK(!is_pending_); 627 DCHECK(!is_pending_);
626 DCHECK(!job_.get()); 628 DCHECK(!job_.get());
627 629
628 net_log_.BeginEvent( 630 net_log_.BeginEvent(
629 NetLog::TYPE_URL_REQUEST_START_JOB, 631 NetLogEventType::URL_REQUEST_START_JOB,
630 base::Bind(&NetLogURLRequestStartCallback, 632 base::Bind(&NetLogURLRequestStartCallback,
631 &url(), &method_, load_flags_, priority_, 633 &url(), &method_, load_flags_, priority_,
632 upload_data_stream_ ? upload_data_stream_->identifier() : -1)); 634 upload_data_stream_ ? upload_data_stream_->identifier() : -1));
633 635
634 job_.reset(job); 636 job_.reset(job);
635 job_->SetExtraRequestHeaders(extra_request_headers_); 637 job_->SetExtraRequestHeaders(extra_request_headers_);
636 job_->SetPriority(priority_); 638 job_->SetPriority(priority_);
637 639
638 if (upload_data_stream_.get()) 640 if (upload_data_stream_.get())
639 job_->SetUpload(upload_data_stream_.get()); 641 job_->SetUpload(upload_data_stream_.get());
640 642
641 is_pending_ = true; 643 is_pending_ = true;
642 is_redirecting_ = false; 644 is_redirecting_ = false;
643 645
644 response_info_.was_cached = false; 646 response_info_.was_cached = false;
645 647
646 if (GURL(referrer_) != URLRequestJob::ComputeReferrerForRedirect( 648 if (GURL(referrer_) != URLRequestJob::ComputeReferrerForRedirect(
647 referrer_policy_, referrer_, url())) { 649 referrer_policy_, referrer_, url())) {
648 if (!network_delegate_ || 650 if (!network_delegate_ ||
649 !network_delegate_->CancelURLRequestWithPolicyViolatingReferrerHeader( 651 !network_delegate_->CancelURLRequestWithPolicyViolatingReferrerHeader(
650 *this, url(), GURL(referrer_))) { 652 *this, url(), GURL(referrer_))) {
651 referrer_.clear(); 653 referrer_.clear();
652 } else { 654 } else {
653 // We need to clear the referrer anyway to avoid an infinite recursion 655 // We need to clear the referrer anyway to avoid an infinite recursion
654 // when starting the error job. 656 // when starting the error job.
655 referrer_.clear(); 657 referrer_.clear();
656 std::string source("delegate"); 658 std::string source("delegate");
657 net_log_.AddEvent(NetLog::TYPE_CANCELLED, 659 net_log_.AddEvent(NetLogEventType::CANCELLED,
658 NetLog::StringCallback("source", &source)); 660 NetLog::StringCallback("source", &source));
659 RestartWithJob(new URLRequestErrorJob( 661 RestartWithJob(new URLRequestErrorJob(
660 this, network_delegate_, ERR_BLOCKED_BY_CLIENT)); 662 this, network_delegate_, ERR_BLOCKED_BY_CLIENT));
661 return; 663 return;
662 } 664 }
663 } 665 }
664 666
665 // Start() always completes asynchronously. 667 // Start() always completes asynchronously.
666 // 668 //
667 // Status is generally set by URLRequestJob itself, but Start() calls 669 // Status is generally set by URLRequestJob itself, but Start() calls
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 714
713 // If the URL request already has an error status, then canceling is a no-op. 715 // 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. 716 // Plus, we don't want to change the error status once it has been set.
715 if (status_.is_success()) { 717 if (status_.is_success()) {
716 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); 718 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error);
717 response_info_.ssl_info = ssl_info; 719 response_info_.ssl_info = ssl_info;
718 720
719 // If the request hasn't already been completed, log a cancellation event. 721 // If the request hasn't already been completed, log a cancellation event.
720 if (!has_notified_completion_) { 722 if (!has_notified_completion_) {
721 // Don't log an error code on ERR_ABORTED, since that's redundant. 723 // Don't log an error code on ERR_ABORTED, since that's redundant.
722 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_CANCELLED, 724 net_log_.AddEventWithNetErrorCode(NetLogEventType::CANCELLED,
723 error == ERR_ABORTED ? OK : error); 725 error == ERR_ABORTED ? OK : error);
724 } 726 }
725 } 727 }
726 728
727 if (is_pending_ && job_.get()) 729 if (is_pending_ && job_.get())
728 job_->Kill(); 730 job_->Kill();
729 731
730 // We need to notify about the end of this job here synchronously. The 732 // 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, 733 // Job sends an asynchronous notification but by the time this is processed,
732 // our |context_| is NULL. 734 // our |context_| is NULL.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 822 }
821 823
822 void URLRequest::NotifyResponseStarted(const URLRequestStatus& status) { 824 void URLRequest::NotifyResponseStarted(const URLRequestStatus& status) {
823 // Change status if there was an error. 825 // Change status if there was an error.
824 if (status.status() != URLRequestStatus::SUCCESS) 826 if (status.status() != URLRequestStatus::SUCCESS)
825 set_status(status); 827 set_status(status);
826 828
827 int net_error = OK; 829 int net_error = OK;
828 if (!status_.is_success()) 830 if (!status_.is_success())
829 net_error = status_.error(); 831 net_error = status_.error();
830 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_URL_REQUEST_START_JOB, 832 net_log_.EndEventWithNetErrorCode(NetLogEventType::URL_REQUEST_START_JOB,
831 net_error); 833 net_error);
832 834
833 URLRequestJob* job = 835 URLRequestJob* job =
834 URLRequestJobManager::GetInstance()->MaybeInterceptResponse( 836 URLRequestJobManager::GetInstance()->MaybeInterceptResponse(
835 this, network_delegate_); 837 this, network_delegate_);
836 if (job) { 838 if (job) {
837 RestartWithJob(job); 839 RestartWithJob(job);
838 } else { 840 } else {
839 // In some cases (e.g. an event was canceled), we might have sent the 841 // In some cases (e.g. an event was canceled), we might have sent the
840 // completion event and receive a NotifyResponseStarted() later. 842 // completion event and receive a NotifyResponseStarted() later.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 899
898 status_ = URLRequestStatus::FromError(ERR_IO_PENDING); 900 status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
899 job_->ContinueDespiteLastError(); 901 job_->ContinueDespiteLastError();
900 } 902 }
901 903
902 void URLRequest::PrepareToRestart() { 904 void URLRequest::PrepareToRestart() {
903 DCHECK(job_.get()); 905 DCHECK(job_.get());
904 906
905 // Close the current URL_REQUEST_START_JOB, since we will be starting a new 907 // Close the current URL_REQUEST_START_JOB, since we will be starting a new
906 // one. 908 // one.
907 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_START_JOB); 909 net_log_.EndEvent(NetLogEventType::URL_REQUEST_START_JOB);
908 910
909 OrphanJob(); 911 OrphanJob();
910 912
911 response_info_ = HttpResponseInfo(); 913 response_info_ = HttpResponseInfo();
912 response_info_.request_time = base::Time::Now(); 914 response_info_.request_time = base::Time::Now();
913 915
914 load_timing_info_ = LoadTimingInfo(); 916 load_timing_info_ = LoadTimingInfo();
915 load_timing_info_.request_start_time = response_info_.request_time; 917 load_timing_info_.request_start_time = response_info_.request_time;
916 load_timing_info_.request_start = base::TimeTicks::Now(); 918 load_timing_info_.request_start = base::TimeTicks::Now();
917 919
(...skipping 13 matching lines...) Expand all
931 // that the callback becomes invalid. 933 // that the callback becomes invalid.
932 job_->Kill(); 934 job_->Kill();
933 job_ = NULL; 935 job_ = NULL;
934 } 936 }
935 937
936 int URLRequest::Redirect(const RedirectInfo& redirect_info) { 938 int URLRequest::Redirect(const RedirectInfo& redirect_info) {
937 // Matches call in NotifyReceivedRedirect. 939 // Matches call in NotifyReceivedRedirect.
938 OnCallToDelegateComplete(); 940 OnCallToDelegateComplete();
939 if (net_log_.IsCapturing()) { 941 if (net_log_.IsCapturing()) {
940 net_log_.AddEvent( 942 net_log_.AddEvent(
941 NetLog::TYPE_URL_REQUEST_REDIRECTED, 943 NetLogEventType::URL_REQUEST_REDIRECTED,
942 NetLog::StringCallback("location", 944 NetLog::StringCallback("location",
943 &redirect_info.new_url.possibly_invalid_spec())); 945 &redirect_info.new_url.possibly_invalid_spec()));
944 } 946 }
945 947
946 // TODO(davidben): Pass the full RedirectInfo to the NetworkDelegate. 948 // TODO(davidben): Pass the full RedirectInfo to the NetworkDelegate.
947 if (network_delegate_) 949 if (network_delegate_)
948 network_delegate_->NotifyBeforeRedirect(this, redirect_info.new_url); 950 network_delegate_->NotifyBeforeRedirect(this, redirect_info.new_url);
949 951
950 if (redirect_limit_ <= 0) { 952 if (redirect_limit_ <= 0) {
951 DVLOG(1) << "disallowing redirect: exceeds limit"; 953 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. 1041 // have MAXIMUM_PRIORITY for release mode.
1040 return; 1042 return;
1041 } 1043 }
1042 1044
1043 if (priority_ == priority) 1045 if (priority_ == priority)
1044 return; 1046 return;
1045 1047
1046 priority_ = priority; 1048 priority_ = priority;
1047 if (job_.get()) { 1049 if (job_.get()) {
1048 net_log_.AddEvent( 1050 net_log_.AddEvent(
1049 NetLog::TYPE_URL_REQUEST_SET_PRIORITY, 1051 NetLogEventType::URL_REQUEST_SET_PRIORITY,
1050 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); 1052 NetLog::StringCallback("priority", RequestPriorityToString(priority_)));
1051 job_->SetPriority(priority_); 1053 job_->SetPriority(priority_);
1052 } 1054 }
1053 } 1055 }
1054 1056
1055 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { 1057 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) {
1056 NetworkDelegate::AuthRequiredResponse rv = 1058 NetworkDelegate::AuthRequiredResponse rv =
1057 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; 1059 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
1058 auth_info_ = auth_info; 1060 auth_info_ = auth_info;
1059 if (network_delegate_) { 1061 if (network_delegate_) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 has_notified_completion_ = true; 1209 has_notified_completion_ = true;
1208 if (network_delegate_) 1210 if (network_delegate_)
1209 network_delegate_->NotifyCompleted(this, job_.get() != NULL, 1211 network_delegate_->NotifyCompleted(this, job_.get() != NULL,
1210 status_.error()); 1212 status_.error());
1211 } 1213 }
1212 1214
1213 void URLRequest::OnCallToDelegate() { 1215 void URLRequest::OnCallToDelegate() {
1214 DCHECK(!calling_delegate_); 1216 DCHECK(!calling_delegate_);
1215 DCHECK(blocked_by_.empty()); 1217 DCHECK(blocked_by_.empty());
1216 calling_delegate_ = true; 1218 calling_delegate_ = true;
1217 net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_DELEGATE); 1219 net_log_.BeginEvent(NetLogEventType::URL_REQUEST_DELEGATE);
1218 } 1220 }
1219 1221
1220 void URLRequest::OnCallToDelegateComplete() { 1222 void URLRequest::OnCallToDelegateComplete() {
1221 // This should have been cleared before resuming the request. 1223 // This should have been cleared before resuming the request.
1222 DCHECK(blocked_by_.empty()); 1224 DCHECK(blocked_by_.empty());
1223 if (!calling_delegate_) 1225 if (!calling_delegate_)
1224 return; 1226 return;
1225 calling_delegate_ = false; 1227 calling_delegate_ = false;
1226 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_DELEGATE); 1228 net_log_.EndEvent(NetLogEventType::URL_REQUEST_DELEGATE);
1227 } 1229 }
1228 1230
1229 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1231 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1230 if (job_) 1232 if (job_)
1231 job_->GetConnectionAttempts(out); 1233 job_->GetConnectionAttempts(out);
1232 else 1234 else
1233 out->clear(); 1235 out->clear();
1234 } 1236 }
1235 1237
1236 void URLRequest::set_status(URLRequestStatus status) { 1238 void URLRequest::set_status(URLRequestStatus status) {
1237 DCHECK(status_.is_io_pending() || status_.is_success() || 1239 DCHECK(status_.is_io_pending() || status_.is_success() ||
1238 (!status.is_success() && !status.is_io_pending())); 1240 (!status.is_success() && !status.is_io_pending()));
1239 status_ = status; 1241 status_ = status;
1240 } 1242 }
1241 1243
1242 } // namespace net 1244 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698