OLD | NEW |
---|---|
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 Loading... | |
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 | |
eroman
2015/11/20 02:21:43
Thanks for doing some estimates!
I would also sug
| |
689 // ~50 reports a day. | |
690 double millis = (base::TimeTicks::Now() - creation_time_).InMillisecondsF(); | |
cbentzel
2015/11/19 01:14:47
Why are you converting to a double instead of just
Charlie Harrison
2015/11/19 02:14:25
No real reason. I can change it back if you want.
cbentzel
2015/11/20 01:05:33
Yes - doing conversion doesn't seem to be doing an
| |
691 if (error == ERR_ABORTED && millis < 100.0 && load_flags_ & LOAD_MAIN_FRAME && | |
692 base::RandDouble() < .0001) { | |
693 GURL url_copy = url(); | |
694 base::debug::Alias(&url_copy); | |
eroman
2015/11/20 02:21:43
This may not save the information you want (becaus
| |
695 base::debug::Alias(&millis); | |
696 base::debug::DumpWithoutCrashing(); | |
eroman
2015/11/20 02:21:43
Please also add a TODO somewhere to delete this co
| |
697 } | |
685 // If cancelled while calling a delegate, clear delegate info. | 698 // If cancelled while calling a delegate, clear delegate info. |
686 if (calling_delegate_) { | 699 if (calling_delegate_) { |
687 LogUnblocked(); | 700 LogUnblocked(); |
688 OnCallToDelegateComplete(); | 701 OnCallToDelegateComplete(); |
689 } | 702 } |
690 | 703 |
691 // If the URL request already has an error status, then canceling is a no-op. | 704 // 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. | 705 // Plus, we don't want to change the error status once it has been set. |
693 if (status_.is_success()) { | 706 if (status_.is_success()) { |
694 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); | 707 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1197 } | 1210 } |
1198 | 1211 |
1199 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { | 1212 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { |
1200 if (job_) | 1213 if (job_) |
1201 job_->GetConnectionAttempts(out); | 1214 job_->GetConnectionAttempts(out); |
1202 else | 1215 else |
1203 out->clear(); | 1216 out->clear(); |
1204 } | 1217 } |
1205 | 1218 |
1206 } // namespace net | 1219 } // namespace net |
OLD | NEW |