| Index: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| index 6417466df43b253a190d3128092632d3b61c913c..bc179d9a90e8d4624c150c28a464ad4b1dbcdc80 100644
|
| --- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| +++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| @@ -93,10 +93,17 @@ void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() {
|
| }
|
|
|
| void ContentSubresourceFilterDriverFactory::OnDocumentLoadStatistics(
|
| - base::TimeDelta evaluation_total_wall_duration,
|
| - base::TimeDelta evaluation_total_cpu_duration) {
|
| - evaluation_total_wall_duration_ += evaluation_total_wall_duration;
|
| - evaluation_total_cpu_duration_ += evaluation_total_cpu_duration;
|
| + const DocumentLoadStatistics& statistics) {
|
| + page_statistics_.num_loads_total += statistics.num_loads_total;
|
| + page_statistics_.num_loads_evaluated += statistics.num_loads_evaluated;
|
| + page_statistics_.num_loads_matching_rules +=
|
| + statistics.num_loads_matching_rules;
|
| + page_statistics_.num_loads_disallowed += statistics.num_loads_disallowed;
|
| +
|
| + page_statistics_.evaluation_total_wall_duration +=
|
| + statistics.evaluation_total_wall_duration;
|
| + page_statistics_.evaluation_total_cpu_duration +=
|
| + statistics.evaluation_total_cpu_duration;
|
| }
|
|
|
| bool ContentSubresourceFilterDriverFactory::IsWhitelisted(
|
| @@ -185,8 +192,7 @@ void ContentSubresourceFilterDriverFactory::DidStartNavigation(
|
| client_->ToggleNotificationVisibility(false);
|
| activation_state_ = ActivationState::DISABLED;
|
| measure_performance_ = false;
|
| - evaluation_total_wall_duration_ = base::TimeDelta();
|
| - evaluation_total_cpu_duration_ = base::TimeDelta();
|
| + page_statistics_ = DocumentLoadStatistics();
|
| }
|
| }
|
|
|
| @@ -222,17 +228,34 @@ void ContentSubresourceFilterDriverFactory::DidFinishLoad(
|
| if (render_frame_host->GetParent())
|
| return;
|
|
|
| + UMA_HISTOGRAM_COUNTS_1000(
|
| + "SubresourceFilter.PageLoad.NumSubresourceLoads.Total",
|
| + page_statistics_.num_loads_total);
|
| + UMA_HISTOGRAM_COUNTS_1000(
|
| + "SubresourceFilter.PageLoad.NumSubresourceLoads.Evaluated",
|
| + page_statistics_.num_loads_evaluated);
|
| + UMA_HISTOGRAM_COUNTS_1000(
|
| + "SubresourceFilter.PageLoad.NumSubresourceLoads.MatchedRules",
|
| + page_statistics_.num_loads_matching_rules);
|
| + UMA_HISTOGRAM_COUNTS_1000(
|
| + "SubresourceFilter.PageLoad.NumSubresourceLoads.Disallowed",
|
| + page_statistics_.num_loads_disallowed);
|
| +
|
| if (measure_performance_) {
|
| DCHECK(activation_state_ != ActivationState::DISABLED);
|
| UMA_HISTOGRAM_CUSTOM_MICRO_TIMES(
|
| "SubresourceFilter.PageLoad.SubresourceEvaluation.TotalWallDuration",
|
| - evaluation_total_wall_duration_, base::TimeDelta::FromMicroseconds(1),
|
| - base::TimeDelta::FromSeconds(10), 50);
|
| -
|
| + page_statistics_.evaluation_total_wall_duration,
|
| + base::TimeDelta::FromMicroseconds(1), base::TimeDelta::FromSeconds(10),
|
| + 50);
|
| UMA_HISTOGRAM_CUSTOM_MICRO_TIMES(
|
| "SubresourceFilter.PageLoad.SubresourceEvaluation.TotalCPUDuration",
|
| - evaluation_total_cpu_duration_, base::TimeDelta::FromMicroseconds(1),
|
| - base::TimeDelta::FromSeconds(10), 50);
|
| + page_statistics_.evaluation_total_cpu_duration,
|
| + base::TimeDelta::FromMicroseconds(1), base::TimeDelta::FromSeconds(10),
|
| + 50);
|
| + } else {
|
| + DCHECK(page_statistics_.evaluation_total_wall_duration.is_zero());
|
| + DCHECK(page_statistics_.evaluation_total_cpu_duration.is_zero());
|
| }
|
| }
|
|
|
| @@ -263,8 +286,7 @@ void ContentSubresourceFilterDriverFactory::ReadyToCommitNavigationInternal(
|
| } else {
|
| activation_state_ = ActivationState::DISABLED;
|
| measure_performance_ = false;
|
| - evaluation_total_wall_duration_ = base::TimeDelta();
|
| - evaluation_total_cpu_duration_ = base::TimeDelta();
|
| + page_statistics_ = DocumentLoadStatistics();
|
| }
|
| } else {
|
| ActivateForFrameHostIfNeeded(render_frame_host, url);
|
|
|