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

Side by Side Diff: net/nqe/network_quality_estimator.cc

Issue 2208733004: Fix crash in NQE: Replace DCHECK by an if-conditional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/nqe/network_quality_estimator.h" 5 #include "net/nqe/network_quality_estimator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (RandDouble() >= correlation_uma_logging_probability_) 794 if (RandDouble() >= correlation_uma_logging_probability_)
795 return; 795 return;
796 796
797 if (request.response_info().was_cached || 797 if (request.response_info().was_cached ||
798 !request.response_info().network_accessed) { 798 !request.response_info().network_accessed) {
799 return; 799 return;
800 } 800 }
801 801
802 LoadTimingInfo load_timing_info; 802 LoadTimingInfo load_timing_info;
803 request.GetLoadTimingInfo(&load_timing_info); 803 request.GetLoadTimingInfo(&load_timing_info);
804 DCHECK(!load_timing_info.send_start.is_null() && 804 // If the load timing info is unavailable, it probably means that the request
805 !load_timing_info.receive_headers_end.is_null()); 805 // did not go over the network.
806 if (load_timing_info.send_start.is_null() ||
807 load_timing_info.receive_headers_end.is_null()) {
808 return;
809 }
806 810
807 // Record UMA only for successful requests that have completed. 811 // Record UMA only for successful requests that have completed.
808 if (!request.status().is_success() || request.status().is_io_pending()) 812 if (!request.status().is_success() || request.status().is_io_pending())
809 return; 813 return;
810 if (request.GetResponseCode() != HTTP_OK) 814 if (request.GetResponseCode() != HTTP_OK)
811 return; 815 return;
812 if (load_timing_info.receive_headers_end < last_main_frame_request_) 816 if (load_timing_info.receive_headers_end < last_main_frame_request_)
813 return; 817 return;
814 818
815 const base::TimeTicks now = tick_clock_->NowTicks(); 819 const base::TimeTicks now = tick_clock_->NowTicks();
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 DCHECK(thread_checker_.CalledOnValidThread()); 1671 DCHECK(thread_checker_.CalledOnValidThread());
1668 DCHECK_NE(EFFECTIVE_CONNECTION_TYPE_LAST, effective_connection_type_); 1672 DCHECK_NE(EFFECTIVE_CONNECTION_TYPE_LAST, effective_connection_type_);
1669 1673
1670 // TODO(tbansal): Add hysteresis in the notification. 1674 // TODO(tbansal): Add hysteresis in the notification.
1671 FOR_EACH_OBSERVER( 1675 FOR_EACH_OBSERVER(
1672 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, 1676 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_,
1673 OnEffectiveConnectionTypeChanged(effective_connection_type_)); 1677 OnEffectiveConnectionTypeChanged(effective_connection_type_));
1674 } 1678 }
1675 1679
1676 } // namespace net 1680 } // 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