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

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

Issue 2917873003: Ignore download bytes in page load metrics. (Closed)
Patch Set: address 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
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4168a511dc6bc40781fd4f758696e2742cc5c170..46d6422ff5d36f66272d76f3f788377641ecb861 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -350,19 +350,21 @@ void NotifyUIThreadOfRequestStarted(
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
const content::GlobalRequestID& request_id,
ResourceType resource_type,
+ bool is_download,
base::TimeTicks request_creation_time) {
content::WebContents* web_contents = web_contents_getter.Run();
-
if (!web_contents)
return;
- page_load_metrics::MetricsWebContentsObserver* metrics_observer =
- page_load_metrics::MetricsWebContentsObserver::FromWebContents(
- web_contents);
+ if (!is_download) {
+ page_load_metrics::MetricsWebContentsObserver* metrics_observer =
+ page_load_metrics::MetricsWebContentsObserver::FromWebContents(
+ web_contents);
- if (metrics_observer) {
- metrics_observer->OnRequestStarted(request_id, resource_type,
- request_creation_time);
+ if (metrics_observer) {
+ metrics_observer->OnRequestStarted(request_id, resource_type,
+ request_creation_time);
+ }
}
}
@@ -373,6 +375,7 @@ void NotifyUIThreadOfRequestComplete(
const GURL& url,
const content::GlobalRequestID& request_id,
ResourceType resource_type,
+ bool is_download,
bool was_cached,
std::unique_ptr<data_reduction_proxy::DataReductionProxyData>
data_reduction_proxy_data,
@@ -400,14 +403,16 @@ void NotifyUIThreadOfRequestComplete(
background_loader->OnNetworkBytesChanged(total_received_bytes);
#endif // OS_ANDROID
}
- page_load_metrics::MetricsWebContentsObserver* metrics_observer =
- page_load_metrics::MetricsWebContentsObserver::FromWebContents(
- web_contents);
- if (metrics_observer) {
- metrics_observer->OnRequestComplete(
- url, frame_tree_node_id_getter.Run(), request_id, resource_type,
- was_cached, std::move(data_reduction_proxy_data), raw_body_bytes,
- original_content_length, request_creation_time);
+ if (!is_download) {
+ page_load_metrics::MetricsWebContentsObserver* metrics_observer =
+ page_load_metrics::MetricsWebContentsObserver::FromWebContents(
+ web_contents);
+ if (metrics_observer) {
+ metrics_observer->OnRequestComplete(
+ url, frame_tree_node_id_getter.Run(), request_id, resource_type,
+ was_cached, std::move(data_reduction_proxy_data), raw_body_bytes,
+ original_content_length, request_creation_time);
+ }
}
}
@@ -478,7 +483,7 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
base::Bind(&NotifyUIThreadOfRequestStarted,
info->GetWebContentsGetterForRequest(),
info->GetGlobalRequestID(), info->GetResourceType(),
- request->creation_time()));
+ info->IsDownload(), request->creation_time()));
ProfileIOData* io_data = ProfileIOData::FromResourceContext(
resource_context);
@@ -870,16 +875,16 @@ void ChromeResourceDispatcherHostDelegate::RequestComplete(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::BindOnce(&NotifyUIThreadOfRequestComplete,
- info->GetWebContentsGetterForRequest(),
- info->GetFrameTreeNodeIdGetterForRequest(),
- url_request->url(), info->GetGlobalRequestID(),
- info->GetResourceType(), url_request->was_cached(),
- base::Passed(&data_reduction_proxy_data), net_error,
- url_request->GetTotalReceivedBytes(),
- url_request->GetRawBodyBytes(), original_content_length,
- url_request->creation_time(),
- base::TimeTicks::Now() - url_request->creation_time()));
+ base::BindOnce(
+ &NotifyUIThreadOfRequestComplete,
+ info->GetWebContentsGetterForRequest(),
+ info->GetFrameTreeNodeIdGetterForRequest(), url_request->url(),
+ info->GetGlobalRequestID(), info->GetResourceType(),
+ info->IsDownload(), url_request->was_cached(),
+ base::Passed(&data_reduction_proxy_data), net_error,
+ url_request->GetTotalReceivedBytes(), url_request->GetRawBodyBytes(),
+ original_content_length, url_request->creation_time(),
+ base::TimeTicks::Now() - url_request->creation_time()));
}
content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState(
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698