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

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

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more 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
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 <stddef.h>
8 #include <stdint.h>
9
7 #include "base/location.h" 10 #include "base/location.h"
8 #include "base/logging.h" 11 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
10 #include "base/metrics/user_metrics.h" 13 #include "base/metrics/user_metrics.h"
11 #include "components/page_load_metrics/browser/page_load_metrics_util.h" 14 #include "components/page_load_metrics/browser/page_load_metrics_util.h"
12 #include "components/page_load_metrics/common/page_load_metrics_messages.h" 15 #include "components/page_load_metrics/common/page_load_metrics_messages.h"
13 #include "components/page_load_metrics/common/page_load_timing.h" 16 #include "components/page_load_metrics/common/page_load_timing.h"
14 #include "components/rappor/rappor_service.h" 17 #include "components/rappor/rappor_service.h"
15 #include "components/rappor/rappor_utils.h" 18 #include "components/rappor/rappor_utils.h"
16 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 98
96 // The number of buckets in the bitfield histogram. These buckets are described 99 // The number of buckets in the bitfield histogram. These buckets are described
97 // in rappor.xml in PageLoad.CoarseTiming.NavigationToFirstContentfulPaint. 100 // in rappor.xml in PageLoad.CoarseTiming.NavigationToFirstContentfulPaint.
98 // The bucket flag is defined by 1 << bucket_index, and is the bitfield 101 // The bucket flag is defined by 1 << bucket_index, and is the bitfield
99 // representing which timing bucket the page load falls into, i.e. 000010 102 // representing which timing bucket the page load falls into, i.e. 000010
100 // would be the bucket flag showing that the page took between 2 and 4 seconds 103 // would be the bucket flag showing that the page took between 2 and 4 seconds
101 // to load. 104 // to load.
102 const size_t kNumRapporHistogramBuckets = 6; 105 const size_t kNumRapporHistogramBuckets = 6;
103 106
104 uint64_t RapporHistogramBucketIndex(const base::TimeDelta& time) { 107 uint64_t RapporHistogramBucketIndex(const base::TimeDelta& time) {
105 int64 seconds = time.InSeconds(); 108 int64_t seconds = time.InSeconds();
106 if (seconds < 2) 109 if (seconds < 2)
107 return 0; 110 return 0;
108 if (seconds < 4) 111 if (seconds < 4)
109 return 1; 112 return 1;
110 if (seconds < 8) 113 if (seconds < 8)
111 return 2; 114 return 2;
112 if (seconds < 16) 115 if (seconds < 16)
113 return 3; 116 return 3;
114 if (seconds < 32) 117 if (seconds < 32)
115 return 4; 118 return 4;
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 642
640 if (!committed_load_->UpdateTiming(timing)) { 643 if (!committed_load_->UpdateTiming(timing)) {
641 // If the page load tracker cannot update its timing, something is wrong 644 // If the page load tracker cannot update its timing, something is wrong
642 // with the IPC (it's from another load, or it's invalid in some other way). 645 // with the IPC (it's from another load, or it's invalid in some other way).
643 // We expect this to be a rare occurrence. 646 // We expect this to be a rare occurrence.
644 RecordInternalError(ERR_BAD_TIMING_IPC); 647 RecordInternalError(ERR_BAD_TIMING_IPC);
645 } 648 }
646 } 649 }
647 650
648 } // namespace page_load_metrics 651 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698