| OLD | NEW |
| 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 "chrome/browser/page_load_metrics/observers/core_page_load_metrics_obse
rver.h" | 5 #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_obse
rver.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "components/page_load_metrics/browser/page_load_metrics_util.h" | 12 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" |
| 13 #include "components/rappor/rappor_service.h" | 13 #include "components/rappor/rappor_service.h" |
| 14 #include "components/rappor/rappor_utils.h" | 14 #include "components/rappor/rappor_utils.h" |
| 15 #include "ui/base/page_transition_types.h" | 15 #include "ui/base/page_transition_types.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // The number of buckets in the bitfield histogram. These buckets are described | 19 // The number of buckets in the bitfield histogram. These buckets are described |
| 20 // in rappor.xml in PageLoad.CoarseTiming.NavigationToFirstContentfulPaint. | 20 // in rappor.xml in PageLoad.CoarseTiming.NavigationToFirstContentfulPaint. |
| 21 // The bucket flag is defined by 1 << bucket_index, and is the bitfield | 21 // The bucket flag is defined by 1 << bucket_index, and is the bitfield |
| 22 // representing which timing bucket the page load falls into, i.e. 000010 | 22 // representing which timing bucket the page load falls into, i.e. 000010 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 RapporHistogramBucketIndex(timing.first_contentful_paint.value()); | 651 RapporHistogramBucketIndex(timing.first_contentful_paint.value()); |
| 652 sample->SetFlagsField("Bucket", uint64_t(1) << bucket_index, | 652 sample->SetFlagsField("Bucket", uint64_t(1) << bucket_index, |
| 653 kNumRapporHistogramBuckets); | 653 kNumRapporHistogramBuckets); |
| 654 // The IsSlow flag is just a one bit boolean if the first contentful paint | 654 // The IsSlow flag is just a one bit boolean if the first contentful paint |
| 655 // was > 10s. | 655 // was > 10s. |
| 656 sample->SetFlagsField( | 656 sample->SetFlagsField( |
| 657 "IsSlow", timing.first_contentful_paint.value().InSecondsF() >= 10, 1); | 657 "IsSlow", timing.first_contentful_paint.value().InSecondsF() >= 10, 1); |
| 658 rappor_service->RecordSampleObj(internal::kRapporMetricsNameCoarseTiming, | 658 rappor_service->RecordSampleObj(internal::kRapporMetricsNameCoarseTiming, |
| 659 std::move(sample)); | 659 std::move(sample)); |
| 660 } | 660 } |
| OLD | NEW |