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

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

Issue 1837233002: Optional <TimeDelta> since they may be non existent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added dcheck when isHighResolution is true. Created 4 years, 6 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
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 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_
6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/optional.h"
9 #include "components/page_load_metrics/common/page_load_timing.h" 10 #include "components/page_load_metrics/common/page_load_timing.h"
10 #include "content/public/browser/navigation_handle.h" 11 #include "content/public/browser/navigation_handle.h"
11 #include "third_party/WebKit/public/web/WebInputEvent.h" 12 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace page_load_metrics { 15 namespace page_load_metrics {
15 16
16 // This enum represents how a page load ends. If the action occurs before the 17 // This enum represents how a page load ends. If the action occurs before the
17 // page load finishes (or reaches some point like first paint), then we consider 18 // page load finishes (or reaches some point like first paint), then we consider
18 // the load to be aborted. 19 // the load to be aborted.
(...skipping 24 matching lines...) Expand all
43 44
44 // The load aborted due to another navigation, but it isn't clear what type of 45 // The load aborted due to another navigation, but it isn't clear what type of
45 // navigation it was. 46 // navigation it was.
46 ABORT_UNKNOWN_NAVIGATION, 47 ABORT_UNKNOWN_NAVIGATION,
47 48
48 // Add values before this final count. 49 // Add values before this final count.
49 ABORT_LAST_ENTRY 50 ABORT_LAST_ENTRY
50 }; 51 };
51 52
52 struct PageLoadExtraInfo { 53 struct PageLoadExtraInfo {
53 PageLoadExtraInfo(base::TimeDelta first_background_time, 54 PageLoadExtraInfo(
54 base::TimeDelta first_foreground_time, 55 const base::Optional<base::TimeDelta>& first_background_time,
55 bool started_in_foreground, 56 const base::Optional<base::TimeDelta>& first_foreground_time,
56 const GURL& committed_url, 57 bool started_in_foreground,
57 base::TimeDelta time_to_commit, 58 const GURL& committed_url,
58 UserAbortType abort_type, 59 const base::Optional<base::TimeDelta>& time_to_commit,
59 base::TimeDelta time_to_abort, 60 UserAbortType abort_type,
60 const PageLoadMetadata& metadata); 61 const base::Optional<base::TimeDelta>& time_to_abort,
62 const PageLoadMetadata& metadata);
63
61 PageLoadExtraInfo(const PageLoadExtraInfo& other); 64 PageLoadExtraInfo(const PageLoadExtraInfo& other);
62 65
66 ~PageLoadExtraInfo();
67
63 // The first time that the page was backgrounded since the navigation started. 68 // The first time that the page was backgrounded since the navigation started.
64 // If the page has not been backgrounded this will be base::TimeDelta(). 69 const base::Optional<base::TimeDelta> first_background_time;
65 const base::TimeDelta first_background_time;
66 70
67 // The first time that the page was foregrounded since the navigation started. 71 // The first time that the page was foregrounded since the navigation started.
68 // If the page has not been foregrounded this will be base::TimeDelta(). 72 const base::Optional<base::TimeDelta> first_foreground_time;
69 const base::TimeDelta first_foreground_time;
70 73
71 // True if the page load started in the foreground. 74 // True if the page load started in the foreground.
72 const bool started_in_foreground; 75 const bool started_in_foreground;
73 76
74 // Committed URL. If the page load did not commit, |committed_url| will be 77 // Committed URL. If the page load did not commit, |committed_url| will be
75 // empty. 78 // empty.
76 const GURL committed_url; 79 const GURL committed_url;
77 80
78 // Time from navigation start until commit. If the page load did not commit, 81 // Time from navigation start until commit.
79 // |time_to_commit| will be zero. 82 const base::Optional<base::TimeDelta> time_to_commit;
80 const base::TimeDelta time_to_commit;
81 83
82 // The abort time and time to abort for this page load. If the page was not 84 // The abort time and time to abort for this page load. If the page was not
83 // aborted, |abort_type| will be |ABORT_NONE| and |time_to_abort| will be 85 // aborted, |abort_type| will be |ABORT_NONE|.
84 // |base::TimeDelta()|.
85 const UserAbortType abort_type; 86 const UserAbortType abort_type;
86 const base::TimeDelta time_to_abort; 87 const base::Optional<base::TimeDelta> time_to_abort;
87 88
88 // Extra information supplied to the page load metrics system from the 89 // Extra information supplied to the page load metrics system from the
89 // renderer. 90 // renderer.
90 const PageLoadMetadata metadata; 91 const PageLoadMetadata metadata;
91 }; 92 };
92 93
93 // Interface for PageLoadMetrics observers. All instances of this class are 94 // Interface for PageLoadMetrics observers. All instances of this class are
94 // owned by the PageLoadTracker tracking a page load. They will be deleted after 95 // owned by the PageLoadTracker tracking a page load. They will be deleted after
95 // calling OnComplete. 96 // calling OnComplete.
96 class PageLoadMetricsObserver { 97 class PageLoadMetricsObserver {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const PageLoadExtraInfo& extra_info) {} 178 const PageLoadExtraInfo& extra_info) {}
178 virtual void OnParseStart(const PageLoadTiming& timing, 179 virtual void OnParseStart(const PageLoadTiming& timing,
179 const PageLoadExtraInfo& extra_info) {} 180 const PageLoadExtraInfo& extra_info) {}
180 virtual void OnParseStop(const PageLoadTiming& timing, 181 virtual void OnParseStop(const PageLoadTiming& timing,
181 const PageLoadExtraInfo& extra_info) {} 182 const PageLoadExtraInfo& extra_info) {}
182 }; 183 };
183 184
184 } // namespace page_load_metrics 185 } // namespace page_load_metrics
185 186
186 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ 187 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698