| OLD | NEW |
| 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 "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" | 9 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" |
| 10 | 10 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return CONTINUE_OBSERVING; | 161 return CONTINUE_OBSERVING; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void SubresourceFilterMetricsObserver::OnComplete( | 164 void SubresourceFilterMetricsObserver::OnComplete( |
| 165 const page_load_metrics::PageLoadTiming& timing, | 165 const page_load_metrics::PageLoadTiming& timing, |
| 166 const page_load_metrics::PageLoadExtraInfo& info) { | 166 const page_load_metrics::PageLoadExtraInfo& info) { |
| 167 OnGoingAway(timing, info, base::TimeTicks()); | 167 OnGoingAway(timing, info, base::TimeTicks()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void SubresourceFilterMetricsObserver::OnLoadedResource( | 170 void SubresourceFilterMetricsObserver::OnLoadedResource( |
| 171 const page_load_metrics::ExtraRequestInfo& extra_request_info) { | 171 const page_load_metrics::ExtraRequestCompleteInfo& |
| 172 if (extra_request_info.was_cached) { | 172 extra_request_complete_info) { |
| 173 if (extra_request_complete_info.was_cached) { |
| 173 ++num_cache_resources_; | 174 ++num_cache_resources_; |
| 174 cache_bytes_ += extra_request_info.raw_body_bytes; | 175 cache_bytes_ += extra_request_complete_info.raw_body_bytes; |
| 175 } else { | 176 } else { |
| 176 ++num_network_resources_; | 177 ++num_network_resources_; |
| 177 network_bytes_ += extra_request_info.raw_body_bytes; | 178 network_bytes_ += extra_request_complete_info.raw_body_bytes; |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 | 181 |
| 181 void SubresourceFilterMetricsObserver::OnParseStop( | 182 void SubresourceFilterMetricsObserver::OnParseStop( |
| 182 const page_load_metrics::PageLoadTiming& timing, | 183 const page_load_metrics::PageLoadTiming& timing, |
| 183 const page_load_metrics::PageLoadExtraInfo& info) { | 184 const page_load_metrics::PageLoadExtraInfo& info) { |
| 184 if (!subresource_filter_observed_) | 185 if (!subresource_filter_observed_) |
| 185 return; | 186 return; |
| 186 | 187 |
| 187 if (!WasStartedInForegroundOptionalEventInForeground( | 188 if (!WasStartedInForegroundOptionalEventInForeground( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 foreground_duration.value()); | 365 foreground_duration.value()); |
| 365 if (timing.paint_timing.first_paint && | 366 if (timing.paint_timing.first_paint && |
| 366 timing.paint_timing.first_paint < foreground_duration) { | 367 timing.paint_timing.first_paint < foreground_duration) { |
| 367 PAGE_LOAD_LONG_HISTOGRAM( | 368 PAGE_LOAD_LONG_HISTOGRAM( |
| 368 internal::kHistogramSubresourceFilterForegroundDurationAfterPaint, | 369 internal::kHistogramSubresourceFilterForegroundDurationAfterPaint, |
| 369 foreground_duration.value() - | 370 foreground_duration.value() - |
| 370 timing.paint_timing.first_paint.value()); | 371 timing.paint_timing.first_paint.value()); |
| 371 } | 372 } |
| 372 } | 373 } |
| 373 } | 374 } |
| OLD | NEW |