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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2798953002: [PageLoadMetrics] Keep track of Ad Sizes on Pages (Closed)
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 web_contents); 360 web_contents);
361 361
362 if (metrics_observer) { 362 if (metrics_observer) {
363 metrics_observer->OnRequestStarted(request_id, resource_type, 363 metrics_observer->OnRequestStarted(request_id, resource_type,
364 request_creation_time); 364 request_creation_time);
365 } 365 }
366 } 366 }
367 367
368 void NotifyUIThreadOfRequestComplete( 368 void NotifyUIThreadOfRequestComplete(
369 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, 369 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
370 const content::ResourceRequestInfo::FrameTreeNodeIdGetter&
371 frame_tree_node_id_getter,
370 const GURL& url, 372 const GURL& url,
371 const content::GlobalRequestID& request_id, 373 const content::GlobalRequestID& request_id,
372 ResourceType resource_type, 374 ResourceType resource_type,
373 bool was_cached, 375 bool was_cached,
374 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> 376 std::unique_ptr<data_reduction_proxy::DataReductionProxyData>
375 data_reduction_proxy_data, 377 data_reduction_proxy_data,
376 int net_error, 378 int net_error,
377 int64_t total_received_bytes, 379 int64_t total_received_bytes,
378 int64_t raw_body_bytes, 380 int64_t raw_body_bytes,
379 int64_t original_content_length, 381 int64_t original_content_length,
(...skipping 14 matching lines...) Expand all
394 offline_pages::BackgroundLoaderOffliner::FromWebContents(web_contents); 396 offline_pages::BackgroundLoaderOffliner::FromWebContents(web_contents);
395 397
396 if (background_loader) 398 if (background_loader)
397 background_loader->OnNetworkBytesChanged(total_received_bytes); 399 background_loader->OnNetworkBytesChanged(total_received_bytes);
398 #endif // OS_ANDROID 400 #endif // OS_ANDROID
399 } 401 }
400 page_load_metrics::MetricsWebContentsObserver* metrics_observer = 402 page_load_metrics::MetricsWebContentsObserver* metrics_observer =
401 page_load_metrics::MetricsWebContentsObserver::FromWebContents( 403 page_load_metrics::MetricsWebContentsObserver::FromWebContents(
402 web_contents); 404 web_contents);
403 if (metrics_observer) { 405 if (metrics_observer) {
404 metrics_observer->OnRequestComplete(request_id, resource_type, was_cached, 406 metrics_observer->OnRequestComplete(
405 std::move(data_reduction_proxy_data), 407 url, frame_tree_node_id_getter.Run(), request_id, resource_type,
406 raw_body_bytes, original_content_length, 408 was_cached, std::move(data_reduction_proxy_data), raw_body_bytes,
407 request_creation_time); 409 original_content_length, request_creation_time);
408 } 410 }
409 } 411 }
410 412
411 } // namespace 413 } // namespace
412 414
413 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() 415 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate()
414 : download_request_limiter_(g_browser_process->download_request_limiter()), 416 : download_request_limiter_(g_browser_process->download_request_limiter()),
415 safe_browsing_(g_browser_process->safe_browsing_service()) 417 safe_browsing_(g_browser_process->safe_browsing_service())
416 #if BUILDFLAG(ENABLE_EXTENSIONS) 418 #if BUILDFLAG(ENABLE_EXTENSIONS)
417 , user_script_listener_(new extensions::UserScriptListener()) 419 , user_script_listener_(new extensions::UserScriptListener())
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 if (data) 863 if (data)
862 data_reduction_proxy_data = data->DeepCopy(); 864 data_reduction_proxy_data = data->DeepCopy();
863 int64_t original_content_length = 865 int64_t original_content_length =
864 data && data->used_data_reduction_proxy() 866 data && data->used_data_reduction_proxy()
865 ? data_reduction_proxy::util::CalculateEffectiveOCL(*url_request) 867 ? data_reduction_proxy::util::CalculateEffectiveOCL(*url_request)
866 : url_request->GetRawBodyBytes(); 868 : url_request->GetRawBodyBytes();
867 869
868 BrowserThread::PostTask( 870 BrowserThread::PostTask(
869 BrowserThread::UI, FROM_HERE, 871 BrowserThread::UI, FROM_HERE,
870 base::BindOnce(&NotifyUIThreadOfRequestComplete, 872 base::BindOnce(&NotifyUIThreadOfRequestComplete,
871 info->GetWebContentsGetterForRequest(), url_request->url(), 873 info->GetWebContentsGetterForRequest(),
872 info->GetGlobalRequestID(), info->GetResourceType(), 874 info->GetFrameTreeNodeIdGetterForRequest(),
873 url_request->was_cached(), 875 url_request->url(), info->GetGlobalRequestID(),
876 info->GetResourceType(), url_request->was_cached(),
874 base::Passed(&data_reduction_proxy_data), net_error, 877 base::Passed(&data_reduction_proxy_data), net_error,
875 url_request->GetTotalReceivedBytes(), 878 url_request->GetTotalReceivedBytes(),
876 url_request->GetRawBodyBytes(), original_content_length, 879 url_request->GetRawBodyBytes(), original_content_length,
877 url_request->creation_time(), 880 url_request->creation_time(),
878 base::TimeTicks::Now() - url_request->creation_time())); 881 base::TimeTicks::Now() - url_request->creation_time()));
879 } 882 }
880 883
881 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( 884 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState(
882 const net::URLRequest& url_request, 885 const net::URLRequest& url_request,
883 content::ResourceContext* resource_context) { 886 content::ResourceContext* resource_context) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 954 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
952 base::Unretained(this), url, request_loading_time)); 955 base::Unretained(this), url, request_loading_time));
953 return; 956 return;
954 } 957 }
955 958
956 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 959 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
957 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 960 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
958 rappor::SampleDomainAndRegistryFromGURL( 961 rappor::SampleDomainAndRegistryFromGURL(
959 g_browser_process->rappor_service(), metric_name, url); 962 g_browser_process->rappor_service(), metric_name, url);
960 } 963 }
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/page_load_metrics/metrics_web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698