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

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

Issue 2008233002: Add ReloadPageLoadMetricsObserver to have a metrics variant for reloads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/reload_page_load_metrics_ob server.h"
6
7 #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_obse rver.h"
8 #include "components/page_load_metrics/browser/page_load_metrics_util.h"
9 #include "ui/base/page_transition_types.h"
10
11 namespace chrome {
12
13 namespace {
14
15 const char kHistogramFirstContentfulPaintReload[] =
16 "PageLoad.Reload.NavigationToFirstContentfulPaint";
Bryan McQuade 2016/05/25 22:53:29 maybe PageLoad.PaintTiming.NavigationToFirstConten
Takashi Toyoshima 2016/05/26 06:06:50 OK, I'll update my CL to use following names tenta
17
18 } // namespace
19
20 ReloadPageLoadMetricsObserver::ReloadPageLoadMetricsObserver()
21 : page_transition_was_reload_(false) {}
22
23 void ReloadPageLoadMetricsObserver::OnCommit(
24 content::NavigationHandle* navigation_handle) {
25 page_transition_was_reload_ = ui::PageTransitionCoreTypeIs(
Bryan McQuade 2016/05/25 22:53:29 if it's accurate, it'd be useful to store a varian
Takashi Toyoshima 2016/05/26 06:06:50 Done.
26 navigation_handle->GetPageTransition(), ui::PAGE_TRANSITION_RELOAD);
27 }
28
29 void ReloadPageLoadMetricsObserver::OnFirstContentfulPaint(
30 const page_load_metrics::PageLoadTiming& timing,
31 const page_load_metrics::PageLoadExtraInfo& extra_info) {
32 if (!page_transition_was_reload_ ||
33 !WasStartedInForegroundEventInForeground(timing.first_contentful_paint,
34 extra_info)) {
35 return;
36 }
37
38 PAGE_LOAD_HISTOGRAM(kHistogramFirstContentfulPaintReload,
39 timing.first_contentful_paint);
40 }
41
42 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698