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

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

Issue 1164823002: Remove URLRequestStatus mutators and introduce FromError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 DCHECK(error < 0); 681 DCHECK(error < 0);
682 // If cancelled while calling a delegate, clear delegate info. 682 // If cancelled while calling a delegate, clear delegate info.
683 if (calling_delegate_) { 683 if (calling_delegate_) {
684 LogUnblocked(); 684 LogUnblocked();
685 OnCallToDelegateComplete(); 685 OnCallToDelegateComplete();
686 } 686 }
687 687
688 // If the URL request already has an error status, then canceling is a no-op. 688 // If the URL request already has an error status, then canceling is a no-op.
689 // Plus, we don't want to change the error status once it has been set. 689 // Plus, we don't want to change the error status once it has been set.
690 if (status_.is_success()) { 690 if (status_.is_success()) {
691 status_.set_status(URLRequestStatus::CANCELED); 691 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error);
692 status_.set_error(error);
693 response_info_.ssl_info = ssl_info; 692 response_info_.ssl_info = ssl_info;
694 693
695 // If the request hasn't already been completed, log a cancellation event. 694 // If the request hasn't already been completed, log a cancellation event.
696 if (!has_notified_completion_) { 695 if (!has_notified_completion_) {
697 // Don't log an error code on ERR_ABORTED, since that's redundant. 696 // Don't log an error code on ERR_ABORTED, since that's redundant.
698 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_CANCELLED, 697 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_CANCELLED,
699 error == ERR_ABORTED ? OK : error); 698 error == ERR_ABORTED ? OK : error);
700 } 699 }
701 } 700 }
702 701
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 } 1189 }
1191 1190
1192 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1191 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1193 if (job_) 1192 if (job_)
1194 job_->GetConnectionAttempts(out); 1193 job_->GetConnectionAttempts(out);
1195 else 1194 else
1196 out->clear(); 1195 out->clear();
1197 } 1196 }
1198 1197
1199 } // namespace net 1198 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698