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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 1610143002: Adds UMA for slow and fast back/forward WKWebController navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pre-review cleanup Created 4 years, 11 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
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_web_controller+protected.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 18aaf164228ffe7f528893ee76c72051d3447da0..076ac3be2034a2e90379e32f2df9808cba6f4a65 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -166,6 +166,23 @@ void CancelAllTouches(UIScrollView* web_scroll_view) {
}
}
+// Key of the UMA Navigation.IOSWKWebViewSlowFastBackForward histogram.
+const char kUMAWKWebViewSlowFastBackForwardNavigationKey[] =
+ "Navigation.IOSWKWebViewSlowFastBackForward";
+
+// Values for the histogram that counts slow/fast back/forward navigations.
+enum BackForwardNavigationType {
+ // Fast back navigation through WKWebView back-forward list.
+ FAST_BACK = 0,
Eugene But (OOO till 7-30) 2016/01/20 16:45:04 Back usually means previous (not negative delta),
stkhapugin 2016/01/21 10:39:36 Stuart mentioned that he'd like to have a distinct
Eugene But (OOO till 7-30) 2016/01/21 15:03:49 The problem here is that FAST_BACK is misleading,
stuartmorgan 2016/01/28 23:25:44 By "negative delta" do you mean going back N>1 pag
+ // Slow back navigation when back-forward list navigation is not possible.
+ SLOW_BACK,
+ // Fast forward navigation through WKWebView back-forward list.
+ FAST_FORWARD,
+ // Slow forward navigation when back-forward list navigation is not possible.
+ SLOW_FORWARD,
+ BACK_FORWARD_NAVIGATION_TYPE_COUNT
+};
+
} // namespace
@interface CRWWebController () <CRWNativeContentDelegate,
@@ -1686,6 +1703,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
}
+- (BOOL)canPerformFastNavigationForSessionEntry:(CRWSessionEntry*)sessionEntry {
+ // Should be overriden by subclasses if they support fast navigation.
+ return NO;
+}
+
- (void)abortLoad {
[self abortWebLoad];
[self loadCancelled];
@@ -1753,6 +1775,26 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
[self finishHistoryNavigationFromEntry:fromEntry];
_webStateImpl->SetCacheMode(net::RequestTracker::CACHE_NORMAL);
}
+
+ // If using WKWebView, report slow/fast navigation metric.
+ if ([self isKindOfClass:[CRWWKWebViewWebController class]]) {
Eugene But (OOO till 7-30) 2016/01/20 16:45:04 I think you should move this code to subclass' goD
stkhapugin 2016/01/21 10:39:36 Done.
+ BOOL isFast =
+ [self canPerformFastNavigationForSessionEntry:self.currentSessionEntry];
+ BOOL isBack = (delta < 0);
+
+ BackForwardNavigationType navigationType;
Eugene But (OOO till 7-30) 2016/01/20 16:45:04 Please always initialize local variables.
stkhapugin 2016/01/21 10:39:36 Done.
+ if (isBack) {
+ navigationType = isFast ? BackForwardNavigationType::FAST_BACK
+ : BackForwardNavigationType::SLOW_BACK;
+ } else {
+ navigationType = isFast ? BackForwardNavigationType::FAST_FORWARD
+ : BackForwardNavigationType::SLOW_FORWARD;
+ }
+
+ UMA_HISTOGRAM_ENUMERATION(
+ kUMAWKWebViewSlowFastBackForwardNavigationKey, navigationType,
+ BackForwardNavigationType::BACK_FORWARD_NAVIGATION_TYPE_COUNT);
+ }
}
- (BOOL)isLoaded {
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_web_controller+protected.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698