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 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> | 356 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> |
355 data_reduction_proxy_data, | 357 data_reduction_proxy_data, |
356 int net_error, | 358 int net_error, |
357 int64_t total_received_bytes, | 359 int64_t total_received_bytes, |
358 int64_t raw_body_bytes, | 360 int64_t raw_body_bytes, |
359 int64_t original_content_length, | 361 int64_t original_content_length, |
(...skipping 14 matching lines...) Expand all Loading... |
374 offline_pages::BackgroundLoaderOffliner::FromWebContents(web_contents); | 376 offline_pages::BackgroundLoaderOffliner::FromWebContents(web_contents); |
375 | 377 |
376 if (background_loader) | 378 if (background_loader) |
377 background_loader->OnNetworkBytesChanged(total_received_bytes); | 379 background_loader->OnNetworkBytesChanged(total_received_bytes); |
378 #endif // OS_ANDROID | 380 #endif // OS_ANDROID |
379 } | 381 } |
380 page_load_metrics::MetricsWebContentsObserver* metrics_observer = | 382 page_load_metrics::MetricsWebContentsObserver* metrics_observer = |
381 page_load_metrics::MetricsWebContentsObserver::FromWebContents( | 383 page_load_metrics::MetricsWebContentsObserver::FromWebContents( |
382 web_contents); | 384 web_contents); |
383 if (metrics_observer) { | 385 if (metrics_observer) { |
384 metrics_observer->OnRequestComplete(request_id, resource_type, was_cached, | 386 metrics_observer->OnRequestComplete( |
385 std::move(data_reduction_proxy_data), | 387 url, frame_tree_node_id_getter.Run(), request_id, resource_type, |
386 raw_body_bytes, original_content_length, | 388 was_cached, std::move(data_reduction_proxy_data), raw_body_bytes, |
387 request_creation_time); | 389 original_content_length, request_creation_time); |
388 } | 390 } |
389 } | 391 } |
390 | 392 |
391 } // namespace | 393 } // namespace |
392 | 394 |
393 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() | 395 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() |
394 : download_request_limiter_(g_browser_process->download_request_limiter()), | 396 : download_request_limiter_(g_browser_process->download_request_limiter()), |
395 safe_browsing_(g_browser_process->safe_browsing_service()) | 397 safe_browsing_(g_browser_process->safe_browsing_service()) |
396 #if BUILDFLAG(ENABLE_EXTENSIONS) | 398 #if BUILDFLAG(ENABLE_EXTENSIONS) |
397 , user_script_listener_(new extensions::UserScriptListener()) | 399 , user_script_listener_(new extensions::UserScriptListener()) |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 if (data) | 832 if (data) |
831 data_reduction_proxy_data = data->DeepCopy(); | 833 data_reduction_proxy_data = data->DeepCopy(); |
832 int64_t original_content_length = | 834 int64_t original_content_length = |
833 data && data->used_data_reduction_proxy() | 835 data && data->used_data_reduction_proxy() |
834 ? data_reduction_proxy::util::CalculateEffectiveOCL(*url_request) | 836 ? data_reduction_proxy::util::CalculateEffectiveOCL(*url_request) |
835 : url_request->GetRawBodyBytes(); | 837 : url_request->GetRawBodyBytes(); |
836 | 838 |
837 BrowserThread::PostTask( | 839 BrowserThread::PostTask( |
838 BrowserThread::UI, FROM_HERE, | 840 BrowserThread::UI, FROM_HERE, |
839 base::BindOnce(&NotifyUIThreadOfRequestComplete, | 841 base::BindOnce(&NotifyUIThreadOfRequestComplete, |
840 info->GetWebContentsGetterForRequest(), url_request->url(), | 842 info->GetWebContentsGetterForRequest(), |
841 info->GetGlobalRequestID(), info->GetResourceType(), | 843 info->GetFrameTreeNodeIdGetterForRequest(), |
842 url_request->was_cached(), | 844 url_request->url(), info->GetGlobalRequestID(), |
| 845 info->GetResourceType(), url_request->was_cached(), |
843 base::Passed(&data_reduction_proxy_data), net_error, | 846 base::Passed(&data_reduction_proxy_data), net_error, |
844 url_request->GetTotalReceivedBytes(), | 847 url_request->GetTotalReceivedBytes(), |
845 url_request->GetRawBodyBytes(), original_content_length, | 848 url_request->GetRawBodyBytes(), original_content_length, |
846 url_request->creation_time(), | 849 url_request->creation_time(), |
847 base::TimeTicks::Now() - url_request->creation_time())); | 850 base::TimeTicks::Now() - url_request->creation_time())); |
848 } | 851 } |
849 | 852 |
850 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( | 853 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( |
851 const net::URLRequest& url_request, | 854 const net::URLRequest& url_request, |
852 content::ResourceContext* resource_context) { | 855 content::ResourceContext* resource_context) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 923 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
921 base::Unretained(this), url, request_loading_time)); | 924 base::Unretained(this), url, request_loading_time)); |
922 return; | 925 return; |
923 } | 926 } |
924 | 927 |
925 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 928 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
926 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 929 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
927 rappor::SampleDomainAndRegistryFromGURL( | 930 rappor::SampleDomainAndRegistryFromGURL( |
928 g_browser_process->rappor_service(), metric_name, url); | 931 g_browser_process->rappor_service(), metric_name, url); |
929 } | 932 } |
OLD | NEW |