Chromium Code Reviews| Index: components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc |
| diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc |
| index 0e755245c872288e89c058fef4010c9bb05cf36e..c48f137f6c72bee341f713b8d5dd072d487aebef 100644 |
| --- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc |
| +++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/bind.h" |
| #include "base/callback.h" |
| #include "base/memory/ptr_util.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "components/subresource_filter/content/browser/async_document_subresource_filter.h" |
| #include "content/public/browser/navigation_handle.h" |
| #include "content/public/browser/render_frame_host.h" |
| @@ -92,6 +93,8 @@ ActivationStateComputingNavigationThrottle::WillProcessResponse() { |
| base::Bind(&ActivationStateComputingNavigationThrottle:: |
| OnActivationStateComputed, |
| weak_ptr_factory_.GetWeakPtr())); |
| + |
| + defer_timestamp_ = base::TimeTicks::Now(); |
| return content::NavigationThrottle::ThrottleCheckResult::DEFER; |
| } |
| @@ -101,6 +104,15 @@ const char* ActivationStateComputingNavigationThrottle::GetNameForLogging() { |
| void ActivationStateComputingNavigationThrottle::OnActivationStateComputed( |
| ActivationState state) { |
| + DCHECK(!defer_timestamp_.is_null()); |
| + base::TimeDelta delay = base::TimeTicks::Now() - defer_timestamp_; |
| + UMA_HISTOGRAM_TIMES("SubresourceFilter.DocumentLoad.ActivationComputingDelay", |
|
pkalinnikov
2017/05/08 12:00:05
Do you expect it to be mostly >= 1 ms?
We also ha
Charlie Harrison
2017/05/08 12:53:33
Yeah we can us microseconds for these metrics (may
|
| + delay); |
| + if (navigation_handle()->IsInMainFrame()) { |
| + UMA_HISTOGRAM_TIMES( |
| + "SubresourceFilter.DocumentLoad.ActivationComputingDelay.MainFrame", |
| + delay); |
| + } |
| navigation_handle()->Resume(); |
| } |