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

Unified Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2798953002: [PageLoadMetrics] Keep track of Ad Sizes on Pages (Closed)
Patch Set: Address comments from PS8 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
Index: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
index 060b362339230c493d70c4a7b6e5a97d5dbd314c..8bb40e62a68b15233739837e43e16ffdabe2aeb1 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -346,9 +346,11 @@ void LogMainFrameMetricsOnUIThread(const GURL& url,
}
void NotifyUIThreadOfRequestComplete(
- const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
+ const content::ResourceRequestInfo::RenderFrameHostGetter&
+ render_frame_host_getter,
const GURL& url,
const content::GlobalRequestID& request_id,
+ int frame_tree_node_id,
ResourceType resource_type,
bool was_cached,
bool used_data_reduction_proxy,
@@ -359,9 +361,14 @@ void NotifyUIThreadOfRequestComplete(
base::TimeTicks request_creation_time,
base::TimeDelta request_loading_time) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- content::WebContents* web_contents = web_contents_getter.Run();
+ content::RenderFrameHost* render_frame_host = render_frame_host_getter.Run();
+ if (!render_frame_host)
+ return;
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host);
if (!web_contents)
return;
+
if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) {
LogMainFrameMetricsOnUIThread(url, net_error, request_loading_time,
web_contents);
@@ -381,8 +388,9 @@ void NotifyUIThreadOfRequestComplete(
web_contents);
if (metrics_observer) {
metrics_observer->OnRequestComplete(
- request_id, resource_type, was_cached, used_data_reduction_proxy,
- raw_body_bytes, original_content_length, request_creation_time);
+ url, render_frame_host->GetFrameTreeNodeId(), request_id, resource_type,
+ was_cached, used_data_reduction_proxy, raw_body_bytes,
+ original_content_length, request_creation_time);
}
}
@@ -852,10 +860,11 @@ void ChromeResourceDispatcherHostDelegate::RequestComplete(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&NotifyUIThreadOfRequestComplete,
- info->GetWebContentsGetterForRequest(), url_request->url(),
- info->GetGlobalRequestID(), info->GetResourceType(),
- url_request->was_cached(), used_data_reduction_proxy,
- net_error, url_request->GetTotalReceivedBytes(),
+ info->GetRenderFrameHostGetterForRequest(), url_request->url(),
+ info->GetGlobalRequestID(), info->GetFrameTreeNodeId(),
+ info->GetResourceType(), url_request->was_cached(),
+ used_data_reduction_proxy, net_error,
+ url_request->GetTotalReceivedBytes(),
url_request->GetRawBodyBytes(), original_content_length,
url_request->creation_time(),
base::TimeTicks::Now() - url_request->creation_time()));

Powered by Google App Engine
This is Rietveld 408576698