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

Side by Side Diff: components/page_load_metrics/browser/page_load_metrics_observer.cc

Issue 1971913002: Prototype for improved and generalized immediate event logging. (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
« no previous file with comments | « components/page_load_metrics/browser/page_load_metrics_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/page_load_metrics/browser/page_load_metrics_observer.h" 5 #include "components/page_load_metrics/browser/page_load_metrics_observer.h"
6 6
7 namespace page_load_metrics { 7 namespace page_load_metrics {
8 8
9 PageLoadExtraInfo::PageLoadExtraInfo(base::TimeDelta first_background_time, 9 PageLoadExtraInfo::PageLoadExtraInfo(base::TimeDelta first_background_time,
10 base::TimeDelta first_foreground_time, 10 base::TimeDelta first_foreground_time,
11 bool started_in_foreground, 11 bool started_in_foreground,
12 const GURL& committed_url, 12 const GURL& committed_url,
13 base::TimeDelta time_to_commit, 13 base::TimeDelta time_to_commit,
14 UserAbortType abort_type, 14 UserAbortType abort_type,
15 base::TimeDelta time_to_abort, 15 base::TimeDelta time_to_abort,
16 const PageLoadMetadata& metadata) 16 const PageLoadMetadata& metadata)
17 : first_background_time(first_background_time), 17 : first_background_time(first_background_time),
18 first_foreground_time(first_foreground_time), 18 first_foreground_time(first_foreground_time),
19 started_in_foreground(started_in_foreground), 19 started_in_foreground(started_in_foreground),
20 committed_url(committed_url), 20 committed_url(committed_url),
21 time_to_commit(time_to_commit), 21 time_to_commit(time_to_commit),
22 abort_type(abort_type), 22 abort_type(abort_type),
23 time_to_abort(time_to_abort), 23 time_to_abort(time_to_abort),
24 metadata(metadata) {} 24 metadata(metadata) {}
25 25
26 PageLoadExtraInfo::PageLoadExtraInfo(const PageLoadExtraInfo& other) = default; 26 PageLoadExtraInfo::PageLoadExtraInfo(const PageLoadExtraInfo& other) = default;
27 27
28 void PageLoadMetricsEventObserver::HandleTimingUpdate(
29 const PageLoadTiming& new_timing,
30 const PageLoadExtraInfo& extra_info) {
31 if (!new_timing.dom_content_loaded_event_start.is_zero() &&
32 last_timing_.dom_content_loaded_event_start.is_zero())
33 OnDomContentLoadedEventStart(new_timing, extra_info);
34 if (!new_timing.load_event_start.is_zero() &&
35 last_timing_.load_event_start.is_zero())
36 OnLoadEventStart(new_timing, extra_info);
37 if (!new_timing.first_layout.is_zero() && last_timing_.first_layout.is_zero())
38 OnFirstLayout(new_timing, extra_info);
39 if (!new_timing.first_paint.is_zero() && last_timing_.first_paint.is_zero())
40 OnFirstPaint(new_timing, extra_info);
41 if (!new_timing.first_text_paint.is_zero() &&
42 last_timing_.first_text_paint.is_zero())
43 OnFirstTextPaint(new_timing, extra_info);
44 if (!new_timing.first_image_paint.is_zero() &&
45 last_timing_.first_image_paint.is_zero())
46 OnFirstImagePaint(new_timing, extra_info);
47 if (!new_timing.first_contentful_paint.is_zero() &&
48 last_timing_.first_contentful_paint.is_zero())
49 OnFirstContentfulPaint(new_timing, extra_info);
50 if (!new_timing.parse_start.is_zero() && last_timing_.parse_start.is_zero())
51 OnParseStart(new_timing, extra_info);
52 if (!new_timing.parse_stop.is_zero() && last_timing_.parse_stop.is_zero())
53 OnParseStop(new_timing, extra_info);
54
55 last_timing_ = new_timing;
56 }
57
28 } // namespace page_load_metrics 58 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « components/page_load_metrics/browser/page_load_metrics_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698