OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 request_loading_time); | 340 request_loading_time); |
341 } else if (net_error == net::ERR_ABORTED) { | 341 } else if (net_error == net::ERR_ABORTED) { |
342 UMA_HISTOGRAM_LONG_TIMES("Net.NTP.Local.RequestTime2.ErrAborted", | 342 UMA_HISTOGRAM_LONG_TIMES("Net.NTP.Local.RequestTime2.ErrAborted", |
343 request_loading_time); | 343 request_loading_time); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 void NotifyUIThreadOfRequestComplete( | 348 void NotifyUIThreadOfRequestComplete( |
349 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, | 349 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, |
| 350 const content::ResourceRequestInfo::FrameTreeNodeIdGetter& |
| 351 frame_tree_node_id_getter, |
350 const GURL& url, | 352 const GURL& url, |
351 const content::GlobalRequestID& request_id, | 353 const content::GlobalRequestID& request_id, |
352 ResourceType resource_type, | 354 ResourceType resource_type, |
353 bool was_cached, | 355 bool was_cached, |
354 bool used_data_reduction_proxy, | 356 bool used_data_reduction_proxy, |
355 int net_error, | 357 int net_error, |
356 int64_t total_received_bytes, | 358 int64_t total_received_bytes, |
357 int64_t raw_body_bytes, | 359 int64_t raw_body_bytes, |
358 int64_t original_content_length, | 360 int64_t original_content_length, |
359 base::TimeTicks request_creation_time, | 361 base::TimeTicks request_creation_time, |
(...skipping 14 matching lines...) Expand all Loading... |
374 | 376 |
375 if (background_loader) | 377 if (background_loader) |
376 background_loader->OnNetworkBytesChanged(total_received_bytes); | 378 background_loader->OnNetworkBytesChanged(total_received_bytes); |
377 #endif // OS_ANDROID | 379 #endif // OS_ANDROID |
378 } | 380 } |
379 page_load_metrics::MetricsWebContentsObserver* metrics_observer = | 381 page_load_metrics::MetricsWebContentsObserver* metrics_observer = |
380 page_load_metrics::MetricsWebContentsObserver::FromWebContents( | 382 page_load_metrics::MetricsWebContentsObserver::FromWebContents( |
381 web_contents); | 383 web_contents); |
382 if (metrics_observer) { | 384 if (metrics_observer) { |
383 metrics_observer->OnRequestComplete( | 385 metrics_observer->OnRequestComplete( |
384 request_id, resource_type, was_cached, used_data_reduction_proxy, | 386 url, frame_tree_node_id_getter.Run(), request_id, resource_type, |
385 raw_body_bytes, original_content_length, request_creation_time); | 387 was_cached, used_data_reduction_proxy, raw_body_bytes, |
| 388 original_content_length, request_creation_time); |
386 } | 389 } |
387 } | 390 } |
388 | 391 |
389 } // namespace | 392 } // namespace |
390 | 393 |
391 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() | 394 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() |
392 : download_request_limiter_(g_browser_process->download_request_limiter()), | 395 : download_request_limiter_(g_browser_process->download_request_limiter()), |
393 safe_browsing_(g_browser_process->safe_browsing_service()) | 396 safe_browsing_(g_browser_process->safe_browsing_service()) |
394 #if BUILDFLAG(ENABLE_EXTENSIONS) | 397 #if BUILDFLAG(ENABLE_EXTENSIONS) |
395 , user_script_listener_(new extensions::UserScriptListener()) | 398 , user_script_listener_(new extensions::UserScriptListener()) |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 data_reduction_proxy::DataReductionProxyData::GetData(*url_request); | 848 data_reduction_proxy::DataReductionProxyData::GetData(*url_request); |
846 bool used_data_reduction_proxy = data && data->used_data_reduction_proxy(); | 849 bool used_data_reduction_proxy = data && data->used_data_reduction_proxy(); |
847 int64_t original_content_length = | 850 int64_t original_content_length = |
848 used_data_reduction_proxy | 851 used_data_reduction_proxy |
849 ? data_reduction_proxy::util::CalculateEffectiveOCL(*url_request) | 852 ? data_reduction_proxy::util::CalculateEffectiveOCL(*url_request) |
850 : url_request->GetRawBodyBytes(); | 853 : url_request->GetRawBodyBytes(); |
851 | 854 |
852 BrowserThread::PostTask( | 855 BrowserThread::PostTask( |
853 BrowserThread::UI, FROM_HERE, | 856 BrowserThread::UI, FROM_HERE, |
854 base::Bind(&NotifyUIThreadOfRequestComplete, | 857 base::Bind(&NotifyUIThreadOfRequestComplete, |
855 info->GetWebContentsGetterForRequest(), url_request->url(), | 858 info->GetWebContentsGetterForRequest(), |
| 859 info->GetFrameTreeNodeIdGetterForRequest(), url_request->url(), |
856 info->GetGlobalRequestID(), info->GetResourceType(), | 860 info->GetGlobalRequestID(), info->GetResourceType(), |
857 url_request->was_cached(), used_data_reduction_proxy, | 861 url_request->was_cached(), used_data_reduction_proxy, |
858 net_error, url_request->GetTotalReceivedBytes(), | 862 net_error, url_request->GetTotalReceivedBytes(), |
859 url_request->GetRawBodyBytes(), original_content_length, | 863 url_request->GetRawBodyBytes(), original_content_length, |
860 url_request->creation_time(), | 864 url_request->creation_time(), |
861 base::TimeTicks::Now() - url_request->creation_time())); | 865 base::TimeTicks::Now() - url_request->creation_time())); |
862 } | 866 } |
863 | 867 |
864 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( | 868 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( |
865 const net::URLRequest& url_request, | 869 const net::URLRequest& url_request, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 937 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
934 base::Unretained(this), url, request_loading_time)); | 938 base::Unretained(this), url, request_loading_time)); |
935 return; | 939 return; |
936 } | 940 } |
937 | 941 |
938 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 942 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
939 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 943 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
940 rappor::SampleDomainAndRegistryFromGURL( | 944 rappor::SampleDomainAndRegistryFromGURL( |
941 g_browser_process->rappor_service(), metric_name, url); | 945 g_browser_process->rappor_service(), metric_name, url); |
942 } | 946 } |
OLD | NEW |