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

Unified 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: Rebased, Fixed non-deterministic tests and Bryan's review comments. 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 side-by-side diff with in-line comments
Download patch
Index: components/page_load_metrics/browser/page_load_metrics_observer.h
diff --git a/components/page_load_metrics/browser/page_load_metrics_observer.h b/components/page_load_metrics/browser/page_load_metrics_observer.h
index b5e951f5cba965244f62b00df04e25c7acaaa9b6..b075473e9140a8e6385c96a39db0f6fd2807173b 100644
--- a/components/page_load_metrics/browser/page_load_metrics_observer.h
+++ b/components/page_load_metrics/browser/page_load_metrics_observer.h
@@ -6,6 +6,7 @@
#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_
#include "base/macros.h"
+#include "base/optional.h"
#include "components/page_load_metrics/common/page_load_timing.h"
#include "content/public/browser/navigation_handle.h"
#include "url/gurl.h"
@@ -49,23 +50,25 @@ enum UserAbortType {
};
struct PageLoadExtraInfo {
- PageLoadExtraInfo(base::TimeDelta first_background_time,
- base::TimeDelta first_foreground_time,
- bool started_in_foreground,
- const GURL& committed_url,
- base::TimeDelta time_to_commit,
- UserAbortType abort_type,
- base::TimeDelta time_to_abort,
- const PageLoadMetadata& metadata);
+ PageLoadExtraInfo(
+ const base::Optional<base::TimeDelta>& first_background_time,
+ const base::Optional<base::TimeDelta>& first_foreground_time,
+ bool started_in_foreground,
+ const GURL& committed_url,
+ const base::Optional<base::TimeDelta>& time_to_commit,
+ UserAbortType abort_type,
+ const base::Optional<base::TimeDelta>& time_to_abort,
+ const PageLoadMetadata& metadata);
+
PageLoadExtraInfo(const PageLoadExtraInfo& other);
+ ~PageLoadExtraInfo();
+
// The first time that the page was backgrounded since the navigation started.
- // If the page has not been backgrounded this will be base::TimeDelta().
- const base::TimeDelta first_background_time;
+ const base::Optional<base::TimeDelta> first_background_time;
// The first time that the page was foregrounded since the navigation started.
- // If the page has not been foregrounded this will be base::TimeDelta().
- const base::TimeDelta first_foreground_time;
+ const base::Optional<base::TimeDelta> first_foreground_time;
// True if the page load started in the foreground.
const bool started_in_foreground;
@@ -74,15 +77,13 @@ struct PageLoadExtraInfo {
// empty.
const GURL committed_url;
- // Time from navigation start until commit. If the page load did not commit,
- // |time_to_commit| will be zero.
- const base::TimeDelta time_to_commit;
+ // Time from navigation start until commit.
+ const base::Optional<base::TimeDelta> time_to_commit;
// The abort time and time to abort for this page load. If the page was not
- // aborted, |abort_type| will be |ABORT_NONE| and |time_to_abort| will be
- // |base::TimeDelta()|.
+ // aborted, |abort_type| will be |ABORT_NONE|
Charlie Harrison 2016/05/19 18:20:49 Add a period at the end of the sentence.
shivanisha 2016/05/23 15:06:44 done
const UserAbortType abort_type;
- const base::TimeDelta time_to_abort;
+ const base::Optional<base::TimeDelta> time_to_abort;
// Extra information supplied to the page load metrics system from the
// renderer.

Powered by Google App Engine
This is Rietveld 408576698