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

Side by Side Diff: chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing nits Created 4 years, 9 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/page_load_metrics/observers/data_reduction_proxy_metric s_observer.h"
6
7 #include "base/metrics/histogram.h"
8 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
9 #include "components/page_load_metrics/browser/page_load_metrics_observer.h"
10 #include "components/page_load_metrics/browser/page_load_metrics_util.h"
11 #include "components/page_load_metrics/common/page_load_timing.h"
12 #include "content/public/browser/navigation_handle.h"
13
14 namespace data_reduction_proxy {
15
16 namespace internal {
17 const char kHistogramFirstContentfulPaintDataReductionProxy[] =
18 "PageLoad.Timing2.NavigationToFirstContentfulPaint_DataReductionProxy";
19 const char kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOn[] =
20 "PageLoad.Timing2.NavigationToFirstContentfulPaint_DataReductionProxy_"
21 "AutoLoFiOn";
22 const char kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOff[] =
23 "PageLoad.Timing2.NavigationToFirstContentfulPaint_DataReductionProxy_"
24 "AutoLofiOff";
25 }
26
27 DataReductionProxyMetricsObserver::DataReductionProxyMetricsObserver()
28 : is_using_lofi_(false), used_data_reduction_proxy_(false) {}
29
30 DataReductionProxyMetricsObserver::~DataReductionProxyMetricsObserver() {}
31
32 void DataReductionProxyMetricsObserver::OnCommit(
33 content::NavigationHandle* navigation_handle) {
34 used_data_reduction_proxy_ = navigation_handle->UsedDataReductionProxy();
35 is_using_lofi_ = navigation_handle->IsUsingLofi();
36 }
37 void DataReductionProxyMetricsObserver::OnComplete(
38 const page_load_metrics::PageLoadTiming& timing,
39 const page_load_metrics::PageLoadExtraInfo& info) {
40 RecordTimingHistograms(timing, info);
41 }
42
43 void DataReductionProxyMetricsObserver::RecordTimingHistograms(
44 const page_load_metrics::PageLoadTiming& timing,
45 const page_load_metrics::PageLoadExtraInfo& info) {
46 if (timing.first_contentful_paint.is_zero() || used_data_reduction_proxy_)
tbansal1 2016/03/08 22:14:43 did you mean !used_data_reduction_proxy?
RyanSturm 2016/03/10 00:37:57 Done.
47 return;
48 PAGE_LOAD_HISTOGRAM(
49 internal::kHistogramFirstContentfulPaintDataReductionProxy,
50 timing.first_contentful_paint);
51 if (is_using_lofi_) {
52 if (data_reduction_proxy::params::IsIncludedInLoFiEnabledFieldTrial()) {
53 PAGE_LOAD_HISTOGRAM(
54 internal::
55 kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOn,
56 timing.first_contentful_paint);
57 } else if (data_reduction_proxy::params::
58 IsIncludedInLoFiControlFieldTrial()) {
59 PAGE_LOAD_HISTOGRAM(
60 internal::
61 kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOff,
62 timing.first_contentful_paint);
63 }
64 }
65 }
66
67 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698