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

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

Issue 2579933002: Add logging for ResourceScheduler events. (Closed)
Patch Set: Created 4 years 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 use_blocked_by_as_load_param_(false), 577 use_blocked_by_as_load_param_(false),
578 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 578 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
579 base::Unretained(this))), 579 base::Unretained(this))),
580 has_notified_completion_(false), 580 has_notified_completion_(false),
581 received_response_content_length_(0), 581 received_response_content_length_(0),
582 creation_time_(base::TimeTicks::Now()) { 582 creation_time_(base::TimeTicks::Now()) {
583 // Sanity check out environment. 583 // Sanity check out environment.
584 DCHECK(base::ThreadTaskRunnerHandle::IsSet()); 584 DCHECK(base::ThreadTaskRunnerHandle::IsSet());
585 585
586 context->url_requests()->insert(this); 586 context->url_requests()->insert(this);
587 net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE); 587 net_log_.BeginEvent(
588 NetLogEventType::REQUEST_ALIVE,
589 base::Bind(&NetLogURLRequestConstructorCallback, &url, priority_));
588 } 590 }
589 591
590 void URLRequest::BeforeRequestComplete(int error) { 592 void URLRequest::BeforeRequestComplete(int error) {
591 DCHECK(!job_.get()); 593 DCHECK(!job_.get());
592 DCHECK_NE(ERR_IO_PENDING, error); 594 DCHECK_NE(ERR_IO_PENDING, error);
593 595
594 // Check that there are no callbacks to already canceled requests. 596 // Check that there are no callbacks to already canceled requests.
595 DCHECK_NE(URLRequestStatus::CANCELED, status_.status()); 597 DCHECK_NE(URLRequestStatus::CANCELED, status_.status());
596 598
597 OnCallToDelegateComplete(); 599 OnCallToDelegateComplete();
(...skipping 22 matching lines...) Expand all
620 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. 622 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
621 tracked_objects::ScopedTracker tracking_profile( 623 tracked_objects::ScopedTracker tracking_profile(
622 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::StartJob")); 624 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::StartJob"));
623 625
624 DCHECK(!is_pending_); 626 DCHECK(!is_pending_);
625 DCHECK(!job_.get()); 627 DCHECK(!job_.get());
626 628
627 net_log_.BeginEvent( 629 net_log_.BeginEvent(
628 NetLogEventType::URL_REQUEST_START_JOB, 630 NetLogEventType::URL_REQUEST_START_JOB,
629 base::Bind(&NetLogURLRequestStartCallback, &url(), &method_, load_flags_, 631 base::Bind(&NetLogURLRequestStartCallback, &url(), &method_, load_flags_,
630 priority_,
631 upload_data_stream_ ? upload_data_stream_->identifier() : -1)); 632 upload_data_stream_ ? upload_data_stream_->identifier() : -1));
632 633
633 job_.reset(job); 634 job_.reset(job);
634 job_->SetExtraRequestHeaders(extra_request_headers_); 635 job_->SetExtraRequestHeaders(extra_request_headers_);
635 job_->SetPriority(priority_); 636 job_->SetPriority(priority_);
636 637
637 if (upload_data_stream_.get()) 638 if (upload_data_stream_.get())
638 job_->SetUpload(upload_data_stream_.get()); 639 job_->SetUpload(upload_data_stream_.get());
639 640
640 is_pending_ = true; 641 is_pending_ = true;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 NOTREACHED(); 1018 NOTREACHED();
1018 // Maintain the invariant that requests with IGNORE_LIMITS set 1019 // Maintain the invariant that requests with IGNORE_LIMITS set
1019 // have MAXIMUM_PRIORITY for release mode. 1020 // have MAXIMUM_PRIORITY for release mode.
1020 return; 1021 return;
1021 } 1022 }
1022 1023
1023 if (priority_ == priority) 1024 if (priority_ == priority)
1024 return; 1025 return;
1025 1026
1026 priority_ = priority; 1027 priority_ = priority;
1027 if (job_.get()) { 1028 net_log_.AddEvent(
1028 net_log_.AddEvent( 1029 NetLogEventType::URL_REQUEST_SET_PRIORITY,
1029 NetLogEventType::URL_REQUEST_SET_PRIORITY, 1030 NetLog::StringCallback("priority", RequestPriorityToString(priority_)));
1030 NetLog::StringCallback("priority", RequestPriorityToString(priority_))); 1031 if (job_.get())
1031 job_->SetPriority(priority_); 1032 job_->SetPriority(priority_);
1032 }
1033 } 1033 }
1034 1034
1035 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { 1035 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) {
1036 NetworkDelegate::AuthRequiredResponse rv = 1036 NetworkDelegate::AuthRequiredResponse rv =
1037 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; 1037 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
1038 auth_info_ = auth_info; 1038 auth_info_ = auth_info;
1039 if (network_delegate_) { 1039 if (network_delegate_) {
1040 OnCallToDelegate(); 1040 OnCallToDelegate();
1041 rv = network_delegate_->NotifyAuthRequired( 1041 rv = network_delegate_->NotifyAuthRequired(
1042 this, 1042 this,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 out->clear(); 1214 out->clear();
1215 } 1215 }
1216 1216
1217 void URLRequest::set_status(URLRequestStatus status) { 1217 void URLRequest::set_status(URLRequestStatus status) {
1218 DCHECK(status_.is_io_pending() || status_.is_success() || 1218 DCHECK(status_.is_io_pending() || status_.is_success() ||
1219 (!status.is_success() && !status.is_io_pending())); 1219 (!status.is_success() && !status.is_io_pending()));
1220 status_ = status; 1220 status_ = status;
1221 } 1221 }
1222 1222
1223 } // namespace net 1223 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698