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

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

Issue 1438863002: Simulated Crash reporting for ErrAborted requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Per browser limit, int64 milliseconds, raw char[] on stack Created 5 years, 1 month 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 "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"
11 #include "base/debug/alias.h"
12 #include "base/debug/dump_without_crashing.h"
11 #include "base/debug/stack_trace.h" 13 #include "base/debug/stack_trace.h"
12 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
13 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
14 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
15 #include "base/profiler/scoped_tracker.h" 17 #include "base/profiler/scoped_tracker.h"
18 #include "base/rand_util.h"
16 #include "base/stl_util.h" 19 #include "base/stl_util.h"
17 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
18 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
19 #include "base/values.h" 22 #include "base/values.h"
20 #include "net/base/auth.h" 23 #include "net/base/auth.h"
21 #include "net/base/chunked_upload_data_stream.h" 24 #include "net/base/chunked_upload_data_stream.h"
22 #include "net/base/host_port_pair.h" 25 #include "net/base/host_port_pair.h"
23 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
24 #include "net/base/load_timing_info.h" 27 #include "net/base/load_timing_info.h"
25 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // This should only be called on a started request. 678 // This should only be called on a started request.
676 if (!is_pending_ || !job_.get() || job_->has_response_started()) { 679 if (!is_pending_ || !job_.get() || job_->has_response_started()) {
677 NOTREACHED(); 680 NOTREACHED();
678 return; 681 return;
679 } 682 }
680 DoCancel(error, ssl_info); 683 DoCancel(error, ssl_info);
681 } 684 }
682 685
683 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { 686 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) {
684 DCHECK(error < 0); 687 DCHECK(error < 0);
688 // ~500,000 ERR_ABORTED < 100ms in Canary channel a day. Sample .01% to get
689 // ~50 reports a day.
690 // TODO(csharrison) Remove this code when crbug.com/557430 is resolved.
691 int64 request_time =
692 (base::TimeTicks::Now() - creation_time_).InMilliseconds();
693 if (error == ERR_ABORTED && request_time <= 100 &&
694 load_flags_ & LOAD_MAIN_FRAME && base::RandDouble() < .0001) {
695 static int dump_times = 0;
eroman 2015/11/23 23:29:05 This works on the assumption that URLRequest is on
mmenke 2015/11/23 23:32:58 I'm not in favor of adding more places that assume
696 if (dump_times < 5) {
697 char url_copy[256] = {0};
698 base::debug::Alias(&url_copy);
eroman 2015/11/23 23:29:05 No need to alias twice (done below as well)
699 strncpy(url_copy, url().spec().c_str(), sizeof(url_copy));
700 base::debug::Alias(&url_copy);
701 base::debug::Alias(&request_time);
702 base::debug::DumpWithoutCrashing();
703 dump_times++;
704 }
705 }
685 // If cancelled while calling a delegate, clear delegate info. 706 // If cancelled while calling a delegate, clear delegate info.
686 if (calling_delegate_) { 707 if (calling_delegate_) {
687 LogUnblocked(); 708 LogUnblocked();
688 OnCallToDelegateComplete(); 709 OnCallToDelegateComplete();
689 } 710 }
690 711
691 // 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.
692 // 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.
693 if (status_.is_success()) { 714 if (status_.is_success()) {
694 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); 715 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error);
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1218 }
1198 1219
1199 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1220 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1200 if (job_) 1221 if (job_)
1201 job_->GetConnectionAttempts(out); 1222 job_->GetConnectionAttempts(out);
1202 else 1223 else
1203 out->clear(); 1224 out->clear();
1204 } 1225 }
1205 1226
1206 } // namespace net 1227 } // 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