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

Side by Side Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 1417903005: Revert of Remove DCHECK_IMPLIES/CHECK_IMPLIES. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" 5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "components/page_load_metrics/common/page_load_metrics_messages.h" 9 #include "components/page_load_metrics/common/page_load_metrics_messages.h"
10 #include "components/page_load_metrics/common/page_load_timing.h" 10 #include "components/page_load_metrics/common/page_load_timing.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 bool IsValidPageLoadTiming(const PageLoadTiming& timing) { 44 bool IsValidPageLoadTiming(const PageLoadTiming& timing) {
45 if (timing.IsEmpty()) 45 if (timing.IsEmpty())
46 return false; 46 return false;
47 47
48 // If we have a non-empty timing, it should always have a navigation start. 48 // If we have a non-empty timing, it should always have a navigation start.
49 DCHECK(!timing.navigation_start.is_null()); 49 DCHECK(!timing.navigation_start.is_null());
50 50
51 // If we have a DOM content loaded event, we should have a response start. 51 // If we have a DOM content loaded event, we should have a response start.
52 DCHECK(timing.dom_content_loaded_event_start.is_zero() || 52 DCHECK_IMPLIES(
53 timing.response_start <= timing.dom_content_loaded_event_start); 53 !timing.dom_content_loaded_event_start.is_zero(),
54 timing.response_start <= timing.dom_content_loaded_event_start);
54 55
55 // If we have a load event, we should have both a response start and a DCL. 56 // If we have a load event, we should have both a response start and a DCL.
56 // TODO(csharrison) crbug.com/536203 shows that sometimes we can get a load 57 // TODO(csharrison) crbug.com/536203 shows that sometimes we can get a load
57 // event without a DCL. Figure out if we can change this condition to use a 58 // event without a DCL. Figure out if we can change this condition to use a
58 // DCHECK instead. 59 // DCHECK instead.
59 if (!timing.load_event_start.is_zero() && 60 if (!timing.load_event_start.is_zero() &&
60 (timing.dom_content_loaded_event_start.is_zero() || 61 (timing.dom_content_loaded_event_start.is_zero() ||
61 timing.response_start > timing.load_event_start || 62 timing.response_start > timing.load_event_start ||
62 timing.dom_content_loaded_event_start > timing.load_event_start)) { 63 timing.dom_content_loaded_event_start > timing.load_event_start)) {
63 return false; 64 return false;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 356
356 if (!committed_load_->UpdateTiming(timing)) { 357 if (!committed_load_->UpdateTiming(timing)) {
357 // If the page load tracker cannot update its timing, something is wrong 358 // If the page load tracker cannot update its timing, something is wrong
358 // with the IPC (it's from another load, or it's invalid in some other way). 359 // with the IPC (it's from another load, or it's invalid in some other way).
359 // We expect this to be a rare occurrence. 360 // We expect this to be a rare occurrence.
360 RecordInternalError(ERR_BAD_TIMING_IPC); 361 RecordInternalError(ERR_BAD_TIMING_IPC);
361 } 362 }
362 } 363 }
363 364
364 } // namespace page_load_metrics 365 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698