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

Unified Diff: components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc

Issue 2861053004: [subresource_filter] Add metrics for all NavigationThrottle delays (Closed)
Patch Set: remove a call to base::TimeTicks::Now() 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 side-by-side diff with in-line comments
Download patch
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..b6e39f433eb938da8a0f6dcac008310619f6a97a 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_time_ = base::TimeTicks::Now();
return content::NavigationThrottle::ThrottleCheckResult::DEFER;
}
@@ -101,6 +104,15 @@ const char* ActivationStateComputingNavigationThrottle::GetNameForLogging() {
void ActivationStateComputingNavigationThrottle::OnActivationStateComputed(
ActivationState state) {
+ DCHECK(!defer_time_.is_null());
+ base::TimeDelta delay = base::TimeTicks::Now() - defer_time_;
+ UMA_HISTOGRAM_TIMES("SubresourceFilter.DocumentLoad.ActivationComputingDelay",
+ delay);
+ if (navigation_handle()->IsInMainFrame()) {
+ UMA_HISTOGRAM_TIMES(
+ "SubresourceFilter.DocumentLoad.ActivationComputingDelay.MainFrame",
+ delay);
+ }
navigation_handle()->Resume();
}

Powered by Google App Engine
This is Rietveld 408576698