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

Unified Diff: content/browser/loader/resource_request_info_impl.cc

Issue 2798953002: [PageLoadMetrics] Keep track of Ad Sizes on Pages (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « content/browser/loader/resource_request_info_impl.h ('k') | content/public/browser/resource_request_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_request_info_impl.cc
diff --git a/content/browser/loader/resource_request_info_impl.cc b/content/browser/loader/resource_request_info_impl.cc
index 9a0371eea7159ea059bf3b4d6510221022d99ec4..d91848f64a18d546f1bc8b6376c7bfa5cf45a0b8 100644
--- a/content/browser/loader/resource_request_info_impl.cc
+++ b/content/browser/loader/resource_request_info_impl.cc
@@ -30,6 +30,13 @@ WebContents* GetWebContentsFromFTNID(int frame_tree_node_id) {
return WebContentsImpl::FromFrameTreeNode(frame_tree_node);
}
+int FrameTreeNodeIdFromHostIds(int render_process_host_id,
+ int render_frame_host_id) {
+ RenderFrameHost* render_frame_host =
+ RenderFrameHost::FromID(render_process_host_id, render_frame_host_id);
+ return render_frame_host ? render_frame_host->GetFrameTreeNodeId() : -1;
+}
+
} // namespace
// ----------------------------------------------------------------------------
@@ -212,6 +219,24 @@ ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const {
render_process_host_id, render_frame_host_id);
}
+ResourceRequestInfo::FrameTreeNodeIdGetter
+ResourceRequestInfoImpl::GetFrameTreeNodeIdGetterForRequest() const {
+ if (frame_tree_node_id_ != -1) {
+ DCHECK(IsBrowserSideNavigationEnabled());
+ return base::Bind([](int id) { return id; }, frame_tree_node_id_);
+ }
+
+ int render_process_host_id = -1;
+ int render_frame_host_id = -1;
+ if (!GetAssociatedRenderFrame(&render_process_host_id,
+ &render_frame_host_id)) {
+ NOTREACHED();
+ }
+
+ return base::Bind(&FrameTreeNodeIdFromHostIds, render_process_host_id,
+ render_frame_host_id);
+}
+
ResourceContext* ResourceRequestInfoImpl::GetContext() const {
return context_;
}
« no previous file with comments | « content/browser/loader/resource_request_info_impl.h ('k') | content/public/browser/resource_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698