[WK2] Log using diagnostic logging how far back in history we navigate
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 19:29:42 +0000 (19:29 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 19:29:42 +0000 (19:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144919
<rdar://problem/20920043>

Reviewed by Gavin Barraclough.

Source/WebCore:

Add diagnostic logging keys for logging back history navigation delta.

* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::deltaKey):
(WebCore::DiagnosticLoggingKeys::backNavigationKey):
* page/DiagnosticLoggingKeys.h:

Source/WebKit2:

Log using diagnostic logging how far back in history we navigate.
When a back navigation or a backward indexed navigation occurs, we
log the delta: (HistoryListSize - 1) - NewHistoryItemIndex.

* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::goToItem):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184210 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/DiagnosticLoggingKeys.cpp
Source/WebCore/page/DiagnosticLoggingKeys.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebBackForwardList.cpp

index 8600fcc..7c7729a 100644 (file)
@@ -1,3 +1,18 @@
+2015-05-12  Chris Dumez  <cdumez@apple.com>
+
+        [WK2] Log using diagnostic logging how far back in history we navigate
+        https://bugs.webkit.org/show_bug.cgi?id=144919
+        <rdar://problem/20920043>
+
+        Reviewed by Gavin Barraclough.
+
+        Add diagnostic logging keys for logging back history navigation delta.
+
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::deltaKey):
+        (WebCore::DiagnosticLoggingKeys::backNavigationKey):
+        * page/DiagnosticLoggingKeys.h:
+
 2015-05-12  Yoav Weiss  <yoav@yoav.ws>
 
         Avoid CSSPrimitiveValue allocation when parsing sizes
index 5e91d10..1a0f3d7 100644 (file)
@@ -263,6 +263,11 @@ String DiagnosticLoggingKeys::cannotSuspendActiveDOMObjectsKey()
     return ASCIILiteral("cannotSuspendActiveDOMObjects");
 }
 
+String DiagnosticLoggingKeys::deltaKey()
+{
+    return ASCIILiteral("delta");
+}
+
 String DiagnosticLoggingKeys::applicationCacheKey()
 {
     return ASCIILiteral("applicationCache");
@@ -273,6 +278,11 @@ String DiagnosticLoggingKeys::audioKey()
     return ASCIILiteral("audio");
 }
 
+String DiagnosticLoggingKeys::backNavigationKey()
+{
+    return ASCIILiteral("backNavigation");
+}
+
 String DiagnosticLoggingKeys::cacheControlNoStoreKey()
 {
     return ASCIILiteral("cacheControlNoStore");
index 0d06e72..c4ddb2f 100644 (file)
@@ -34,9 +34,11 @@ class DiagnosticLoggingKeys {
 public:
     static String applicationCacheKey();
     static String audioKey();
+    WEBCORE_EXPORT static String backNavigationKey();
     WEBCORE_EXPORT static String cacheControlNoStoreKey();
     static String cachedResourceRevalidationKey();
     static String cannotSuspendActiveDOMObjectsKey();
+    WEBCORE_EXPORT static String deltaKey();
     static String deniedByClientKey();
     static String deviceMotionKey();
     static String deviceOrientationKey();
index 4884bed..59055f5 100644 (file)
@@ -1,3 +1,18 @@
+2015-05-12  Chris Dumez  <cdumez@apple.com>
+
+        [WK2] Log using diagnostic logging how far back in history we navigate
+        https://bugs.webkit.org/show_bug.cgi?id=144919
+        <rdar://problem/20920043>
+
+        Reviewed by Gavin Barraclough.
+
+        Log using diagnostic logging how far back in history we navigate.
+        When a back navigation or a backward indexed navigation occurs, we
+        log the delta: (HistoryListSize - 1) - NewHistoryItemIndex.
+
+        * UIProcess/WebBackForwardList.cpp:
+        (WebKit::WebBackForwardList::goToItem):
+
 2015-05-11  Sam Weinig  <sam@webkit.org>
 
         ChildProcess should take an os_activity
index 0ee6469..e9fb3e2 100644 (file)
@@ -29,6 +29,7 @@
 #include "APIArray.h"
 #include "SessionState.h"
 #include "WebPageProxy.h"
+#include <WebCore/DiagnosticLoggingKeys.h>
 
 namespace WebKit {
 
@@ -175,6 +176,12 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item)
     if (targetIndex == notFound)
         return;
 
+    if (targetIndex < m_currentIndex) {
+        unsigned delta = m_entries.size() - targetIndex - 1;
+        String deltaValue = delta > 10 ? ASCIILiteral("over10") : String::number(delta);
+        m_page->logDiagnosticMessageWithValue(WebCore::DiagnosticLoggingKeys::backNavigationKey(), WebCore::DiagnosticLoggingKeys::deltaKey(), deltaValue, false /* shouldSample */);
+    }
+
     // If we're going to an item different from the current item, ask the client if the current
     // item should remain in the list.
     WebBackForwardListItem* currentItem = m_entries[m_currentIndex].get();