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

Unified Diff: chrome/browser/page_load_metrics/page_load_tracker.h

Issue 2859393002: Report page load timing information for child frames. (Closed)
Patch Set: add comment Created 3 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: chrome/browser/page_load_metrics/page_load_tracker.h
diff --git a/chrome/browser/page_load_metrics/page_load_tracker.h b/chrome/browser/page_load_metrics/page_load_tracker.h
index f6529d1a059d00a620572763477253d17ed8fec0..1a0b43fd775995f98f30fe5339df73a34ef23c33 100644
--- a/chrome/browser/page_load_metrics/page_load_tracker.h
+++ b/chrome/browser/page_load_metrics/page_load_tracker.h
@@ -26,6 +26,7 @@ class WebInputEvent;
namespace content {
class NavigationHandle;
+class RenderFrameHost;
} // namespace content
namespace page_load_metrics {
@@ -152,8 +153,8 @@ enum InternalErrorLoadEvent {
// No page load end time was recorded for this page load.
ERR_NO_PAGE_LOAD_END_TIME,
- // Received a timing update from a subframe.
- ERR_TIMING_IPC_FROM_SUBFRAME,
+ // Received a timing update from a subframe (deprecated).
+ DEPRECATED_ERR_TIMING_IPC_FROM_SUBFRAME,
// A timing IPC was sent from the renderer that contained timing data which
// was inconsistent with our timing data for the currently committed load.
@@ -168,6 +169,15 @@ enum InternalErrorLoadEvent {
// (e.g. out of order timings, or other issues).
ERR_BAD_TIMING_IPC_INVALID_TIMING,
+ // We received an IPC for a subframe when we weren't tracking a committed load
+ // in that frame. This can happen if the frame fails to commit but a document
+ // is created in it from the parent document via document.open().
+ ERR_SUBFRAME_IPC_WITH_NO_RELEVANT_LOAD,
+
+ // We received a navigation start for a child frame that is before the
+ // navigation start of the main frame.
+ ERR_SUBFRAME_NAVIGATION_START_BEFORE_MAIN_FRAME,
+
// Add values before this final count.
ERR_LAST_ENTRY,
};
@@ -179,6 +189,7 @@ void RecordInternalError(InternalErrorLoadEvent event);
PageEndReason EndReasonForPageTransition(ui::PageTransition transition);
void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url);
bool IsNavigationUserInitiated(content::NavigationHandle* handle);
+content::RenderFrameHost* GetMainFrame(content::RenderFrameHost* rfh);
// This class tracks a given page load, starting from navigation start /
// provisional load, until a new navigation commits or the navigation fails.
@@ -222,10 +233,14 @@ class PageLoadTracker {
void UpdateTiming(const PageLoadTiming& timing,
const PageLoadMetadata& metadata);
+ void UpdateSubFrameTiming(content::RenderFrameHost* render_frame_host,
+ const PageLoadTiming& new_timing,
+ const PageLoadMetadata& new_metadata);
+
// Update metadata for child frames. Updates for child frames arrive
// separately from updates for the main frame, so aren't included in
// UpdateTiming.
- void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata);
+ void UpdateSubFrameMetadata(const PageLoadMetadata& child_metadata);
jkarlin 2017/05/10 16:55:28 Why the rename? Should the comments and argument s
Bryan McQuade 2017/05/10 18:06:15 I wanted to mirror your naming for the subframe co
void OnStartedResource(
const ExtraRequestStartInfo& extra_request_started_info);
@@ -306,6 +321,8 @@ class PageLoadTracker {
base::TimeDelta actual_delay);
private:
+ using FrameTreeNodeId = int;
+
// This function converts a TimeTicks value taken in the browser process
// to navigation_start_ if:
// - base::TimeTicks is not comparable across processes because the clock
@@ -326,6 +343,12 @@ class PageLoadTracker {
void MaybeUpdateURL(content::NavigationHandle* navigation_handle);
+ // Merge values from |new_paint_timing| into |merged_page_timing_|, offsetting
+ // any new timings by the |navigation_start_offset|.
+ void MergePaintTiming(base::TimeDelta navigation_start_offset,
+ const page_load_metrics::PaintTiming& new_paint_timing,
+ bool is_main_frame);
+
UserInputTracker input_tracker_;
// Whether we stopped tracking this navigation after it was initiated. We may
@@ -375,7 +398,11 @@ class PageLoadTracker {
base::TimeTicks foreground_time_;
bool started_in_foreground_;
- PageLoadTiming timing_;
+ // PageLoadTiming for the currently tracked page. The fields in |paint_timing|
+ // are merged across all frames in the document. All other fields are for the
+ // main frame document.
+ PageLoadTiming merged_page_timing_;
+
PageLoadMetadata main_frame_metadata_;
PageLoadMetadata child_frame_metadata_;
@@ -403,6 +430,11 @@ class PageLoadTracker {
std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_;
+ // Navigation start offsets for the most recently committed document in each
+ // frame.
+ std::map<FrameTreeNodeId, base::TimeDelta>
+ child_frame_navigation_start_offset_;
+
DISALLOW_COPY_AND_ASSIGN(PageLoadTracker);
};

Powered by Google App Engine
This is Rietveld 408576698