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

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

Issue 1645513003: Remove simulated crash in URLRequest::DoCancel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/debug/alias.h"
14 #include "base/debug/dump_without_crashing.h"
15 #include "base/debug/stack_trace.h" 13 #include "base/debug/stack_trace.h"
16 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
17 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
18 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
19 #include "base/profiler/scoped_tracker.h" 17 #include "base/profiler/scoped_tracker.h"
20 #include "base/rand_util.h" 18 #include "base/rand_util.h"
21 #include "base/stl_util.h" 19 #include "base/stl_util.h"
22 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
23 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
24 #include "base/values.h" 22 #include "base/values.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // This should only be called on a started request. 696 // This should only be called on a started request.
699 if (!is_pending_ || !job_.get() || job_->has_response_started()) { 697 if (!is_pending_ || !job_.get() || job_->has_response_started()) {
700 NOTREACHED(); 698 NOTREACHED();
701 return; 699 return;
702 } 700 }
703 DoCancel(error, ssl_info); 701 DoCancel(error, ssl_info);
704 } 702 }
705 703
706 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { 704 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) {
707 DCHECK(error < 0); 705 DCHECK(error < 0);
708 // ~500,000 ERR_ABORTED < 100ms in Canary channel a day. Sample .01% to get
709 // ~50 reports a day.
710 // TODO(csharrison) Remove this code when crbug.com/557430 is resolved.
711 int64_t request_time =
712 (base::TimeTicks::Now() - creation_time_).InMilliseconds();
713 if (!has_notified_completion_ && error == ERR_ABORTED &&
714 request_time <= 100 && load_flags_ & LOAD_MAIN_FRAME &&
715 base::RandDouble() < .00001) {
716 static int dump_times = 0;
717 if (dump_times < 5) {
718 char url_copy[256] = {0};
719 strncpy(url_copy, url().spec().c_str(), sizeof(url_copy));
720 base::debug::Alias(&url_copy);
721 base::debug::Alias(&request_time);
722 base::debug::DumpWithoutCrashing();
723 dump_times++;
724 }
725 }
726 // If cancelled while calling a delegate, clear delegate info. 706 // If cancelled while calling a delegate, clear delegate info.
727 if (calling_delegate_) { 707 if (calling_delegate_) {
728 LogUnblocked(); 708 LogUnblocked();
729 OnCallToDelegateComplete(); 709 OnCallToDelegateComplete();
730 } 710 }
731 711
732 // If the URL request already has an error status, then canceling is a no-op. 712 // If the URL request already has an error status, then canceling is a no-op.
733 // Plus, we don't want to change the error status once it has been set. 713 // Plus, we don't want to change the error status once it has been set.
734 if (status_.is_success()) { 714 if (status_.is_success()) {
735 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); 715 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error);
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 } 1216 }
1237 1217
1238 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1218 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1239 if (job_) 1219 if (job_)
1240 job_->GetConnectionAttempts(out); 1220 job_->GetConnectionAttempts(out);
1241 else 1221 else
1242 out->clear(); 1222 out->clear();
1243 } 1223 }
1244 1224
1245 } // namespace net 1225 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698