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

Side by Side Diff: chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer.cc

Issue 2841933003: [subresource_filter] Remove some state from the driver factory (Closed)
Patch Set: no more dep branch Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/subresource_filter/subresource_filter_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/page_load_metrics/observers/subresource_filter_metrics_ observer.h" 5 #include "chrome/browser/page_load_metrics/observers/subresource_filter_metrics_ observer.h"
6 6
7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" 7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
8 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" 8 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h"
9 #include "components/subresource_filter/content/browser/content_subresource_filt er_throttle_manager.h"
10 #include "components/subresource_filter/core/common/activation_decision.h"
9 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" 11 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
10 12
11 using subresource_filter::ContentSubresourceFilterDriverFactory; 13 using subresource_filter::ContentSubresourceFilterDriverFactory;
12 14
13 using ActivationDecision = subresource_filter:: 15 using ActivationDecision = subresource_filter::ActivationDecision;
14 ContentSubresourceFilterDriverFactory::ActivationDecision;
15 16
16 namespace internal { 17 namespace internal {
17 18
18 const char kHistogramSubresourceFilterFirstContentfulPaint[] = 19 const char kHistogramSubresourceFilterFirstContentfulPaint[] =
19 "PageLoad.Clients.SubresourceFilter.PaintTiming." 20 "PageLoad.Clients.SubresourceFilter.PaintTiming."
20 "NavigationToFirstContentfulPaint"; 21 "NavigationToFirstContentfulPaint";
21 const char kHistogramSubresourceFilterParseStartToFirstContentfulPaint[] = 22 const char kHistogramSubresourceFilterParseStartToFirstContentfulPaint[] =
22 "PageLoad.Clients.SubresourceFilter.PaintTiming." 23 "PageLoad.Clients.SubresourceFilter.PaintTiming."
23 "ParseStartToFirstContentfulPaint"; 24 "ParseStartToFirstContentfulPaint";
24 const char kHistogramSubresourceFilterFirstMeaningfulPaint[] = 25 const char kHistogramSubresourceFilterFirstMeaningfulPaint[] =
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 page_load_metrics::PageLoadMetricsObserver::ObservePolicy 152 page_load_metrics::PageLoadMetricsObserver::ObservePolicy
152 SubresourceFilterMetricsObserver::OnCommit( 153 SubresourceFilterMetricsObserver::OnCommit(
153 content::NavigationHandle* navigation_handle) { 154 content::NavigationHandle* navigation_handle) {
154 const auto* subres_filter = 155 const auto* subres_filter =
155 ContentSubresourceFilterDriverFactory::FromWebContents( 156 ContentSubresourceFilterDriverFactory::FromWebContents(
156 navigation_handle->GetWebContents()); 157 navigation_handle->GetWebContents());
157 if (subres_filter) 158 if (subres_filter)
158 LogActivationDecisionMetrics( 159 LogActivationDecisionMetrics(
159 navigation_handle, 160 navigation_handle,
160 subres_filter->GetActivationDecisionForLastCommittedPageLoad()); 161 subres_filter->throttle_manager()
engedy 2017/04/27 13:59:52 I can see two somewhat acceptable options here (re
162 ->GetActivationDecisionForLastCommittedPageLoad());
161 return CONTINUE_OBSERVING; 163 return CONTINUE_OBSERVING;
162 } 164 }
163 165
164 void SubresourceFilterMetricsObserver::OnComplete( 166 void SubresourceFilterMetricsObserver::OnComplete(
165 const page_load_metrics::PageLoadTiming& timing, 167 const page_load_metrics::PageLoadTiming& timing,
166 const page_load_metrics::PageLoadExtraInfo& info) { 168 const page_load_metrics::PageLoadExtraInfo& info) {
167 OnGoingAway(timing, info, base::TimeTicks()); 169 OnGoingAway(timing, info, base::TimeTicks());
168 } 170 }
169 171
170 void SubresourceFilterMetricsObserver::OnLoadedResource( 172 void SubresourceFilterMetricsObserver::OnLoadedResource(
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 foreground_duration.value()); 367 foreground_duration.value());
366 if (timing.paint_timing.first_paint && 368 if (timing.paint_timing.first_paint &&
367 timing.paint_timing.first_paint < foreground_duration) { 369 timing.paint_timing.first_paint < foreground_duration) {
368 PAGE_LOAD_LONG_HISTOGRAM( 370 PAGE_LOAD_LONG_HISTOGRAM(
369 internal::kHistogramSubresourceFilterForegroundDurationAfterPaint, 371 internal::kHistogramSubresourceFilterForegroundDurationAfterPaint,
370 foreground_duration.value() - 372 foreground_duration.value() -
371 timing.paint_timing.first_paint.value()); 373 timing.paint_timing.first_paint.value());
372 } 374 }
373 } 375 }
374 } 376 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/subresource_filter/subresource_filter_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698