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

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

Issue 2385103002: Deprecate StaleWhileRevalidateMetricsObserver (Closed)
Patch Set: build rule Created 4 years, 2 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 2015 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/stale_while_revalidate_metr ics_observer.h"
6
7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
8 #include "chrome/common/page_load_metrics/page_load_timing.h"
9 #include "content/public/browser/navigation_handle.h"
10 #include "net/base/stale_while_revalidate_experiment_domains.h"
11
12 namespace chrome {
13
14 StaleWhileRevalidateMetricsObserver::StaleWhileRevalidateMetricsObserver() {}
15
16 page_load_metrics::PageLoadMetricsObserver::ObservePolicy
17 StaleWhileRevalidateMetricsObserver::OnCommit(
18 content::NavigationHandle* navigation_handle) {
19 return net::IsHostInStaleWhileRevalidateExperimentDomain(
20 navigation_handle->GetURL().host())
21 ? CONTINUE_OBSERVING
22 : STOP_OBSERVING;
23 }
24
25 void StaleWhileRevalidateMetricsObserver::OnComplete(
26 const page_load_metrics::PageLoadTiming& timing,
27 const page_load_metrics::PageLoadExtraInfo& extra_info) {
28 using page_load_metrics::WasStartedInForegroundOptionalEventInForeground;
29
30 if (WasStartedInForegroundOptionalEventInForeground(timing.load_event_start,
31 extra_info)) {
32 PAGE_LOAD_HISTOGRAM(
33 "PageLoad.Clients.StaleWhileRevalidateExperiment.Timing2."
34 "NavigationToLoadEventFired",
35 timing.load_event_start.value());
36 }
37 if (WasStartedInForegroundOptionalEventInForeground(timing.first_layout,
38 extra_info)) {
39 PAGE_LOAD_HISTOGRAM(
40 "PageLoad.Clients.StaleWhileRevalidateExperiment.Timing2."
41 "NavigationToFirstLayout",
42 timing.first_layout.value());
43 }
44 if (WasStartedInForegroundOptionalEventInForeground(timing.first_text_paint,
45 extra_info)) {
46 PAGE_LOAD_HISTOGRAM(
47 "PageLoad.Clients.StaleWhileRevalidateExperiment.Timing2."
48 "NavigationToFirstTextPaint",
49 timing.first_text_paint.value());
50 }
51 }
52
53 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698