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

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 {
Charlie Harrison 2016/03/11 16:06:04 nit: Add a newline after { and before }.
RyanSturm 2016/03/14 21:00:45 Done.
17 const char kHistogramFirstContentfulPaintDataReductionProxy[] =
18 "PageLoad.Timing2.NavigationToFirstContentfulPaint_DataReductionProxy";
Charlie Harrison 2016/03/11 16:06:04 Can you use the more common "PageLoad.Clients.Data
RyanSturm 2016/03/14 21:00:45 Done.
19 const char kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOn[] =
20 "PageLoad.Timing2.NavigationToFirstContentfulPaint_DataReductionProxy_"
21 "AutoLoFiOn";
22 const char kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOff[] =
23 "PageLoad.Timing2.NavigationToFirstContentfulPaint_DataReductionProxy_"
24 "AutoLofiOff";
25 }
Charlie Harrison 2016/03/11 16:06:04 // namespace
RyanSturm 2016/03/14 21:00:46 Done.
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);
Charlie Harrison 2016/03/11 16:06:04 Why the need for a separate method?
RyanSturm 2016/03/14 21:00:46 I prefer longer methods be aptly named, and I expe
41 }
42
43 void DataReductionProxyMetricsObserver::RecordTimingHistograms(
44 const page_load_metrics::PageLoadTiming& timing,
45 const page_load_metrics::PageLoadExtraInfo& info) const {
46 if (timing.first_contentful_paint.is_zero() || !used_data_reduction_proxy_)
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::kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOn,
55 timing.first_contentful_paint);
56 } else if (data_reduction_proxy::params::
57 IsIncludedInLoFiControlFieldTrial()) {
58 PAGE_LOAD_HISTOGRAM(
59 internal::kHistogramFirstContentfulPaintDataReductionProxyAutoLofiOff,
60 timing.first_contentful_paint);
61 }
62 }
63 }
64
65 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698