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

Unified Diff: components/page_load_metrics/common/page_load_timing.h

Issue 1312213010: PageLoadMetrics renderer and browser implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/common/page_load_timing.h
diff --git a/components/page_load_metrics/common/page_load_timing.h b/components/page_load_metrics/common/page_load_timing.h
new file mode 100644
index 0000000000000000000000000000000000000000..b923d5a880de7c28f03db5a7aaf3af9ccd99e6f5
--- /dev/null
+++ b/components/page_load_metrics/common/page_load_timing.h
@@ -0,0 +1,60 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PAGE_LOAD_METRICS_COMMON_PAGE_LOAD_TIMING_H_
+#define COMPONENTS_PAGE_LOAD_METRICS_COMMON_PAGE_LOAD_TIMING_H_
+
+#include "base/time/time.h"
+
+namespace blink {
+class WebPerformance;
+}
+
+namespace page_load_metrics {
+
+// PageLoadTiming contains timing metrics associated with a page load. Many of
+// the metrics here are based on the Navigation Timing spec:
+// http://www.w3.org/TR/navigation-timing/.
+struct PageLoadTiming {
+ public:
+ PageLoadTiming();
+ PageLoadTiming(blink::WebPerformance&);
Bryan McQuade 2015/09/02 18:26:46 can you make the function parameter const?
Charlie Harrison 2015/09/03 14:00:52 Done.
+ ~PageLoadTiming();
+
+ bool operator==(const PageLoadTiming& other) const;
Bryan McQuade 2015/09/02 18:26:46 I think randy had suggested trying to use the defa
Charlie Harrison 2015/09/03 14:00:52 According to this: http://en.cppreference.com/w/cp
+
+ // Returns true if |parent| is equal to |this| besides for uninitialized
+ // fields in |parent|
+ bool IsChild(const PageLoadTiming& parent) const;
Bryan McQuade 2015/09/02 18:26:46 Though these methods logically make sense as membe
Charlie Harrison 2015/09/03 14:00:52 Randy said it's reasonable to move them, but he is
+
+ bool IsComplete() const;
+ bool IsEmpty() const;
+ // Checks guaranteed ordering for performance events.
+ // Assumes IsComplete()
+ bool IsOrdered() const;
+
+ // Time that the navigation for the associated page was initiated.
+ base::Time navigation_start;
+
+ // Time that the first byte of the response is received.
+ base::TimeDelta response_start;
+
+ // Time immediately before the DOMContentLoaded event is fired.
+ base::TimeDelta dom_content_loaded_event_start;
+
+ // Time immediately before the load event is fired.
+ base::TimeDelta load_event_start;
+
+ // Time when the first layout is completed.
+ base::TimeDelta first_layout;
+
+ // If you add additional members, also be sure to update operator== and
+ // page_load_metrics_messages.h
+ private:
+ base::TimeDelta ClampDelta(double event_ms, double start_ms) const;
+};
+
+} // namespace page_load_metrics
+
+#endif // COMPONENTS_PAGE_LOAD_METRICS_COMMON_PAGE_LOAD_TIMING_H_

Powered by Google App Engine
This is Rietveld 408576698