Title: [178298] trunk/Source/WebCore
Revision
178298
Author
cdu...@apple.com
Date
2015-01-12 14:30:59 -0800 (Mon, 12 Jan 2015)

Log Message

Log navigation types using DiagnosticLoggingClient
https://bugs.webkit.org/show_bug.cgi?id=140323

Reviewed by Darin Adler.

Log navigation types using DiagnosticLoggingClient to help us understand
what types of navigations are common and give us an estimate on the
total number of navigations.

* loader/FrameLoader.cpp:
(WebCore::logNavigation):
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::logNavigationWithFeatureCounter): Deleted.
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::navigationKey):
* page/DiagnosticLoggingKeys.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (178297 => 178298)


--- trunk/Source/WebCore/ChangeLog	2015-01-12 22:02:56 UTC (rev 178297)
+++ trunk/Source/WebCore/ChangeLog	2015-01-12 22:30:59 UTC (rev 178298)
@@ -1,3 +1,22 @@
+2015-01-12  Chris Dumez  <cdu...@apple.com>
+
+        Log navigation types using DiagnosticLoggingClient
+        https://bugs.webkit.org/show_bug.cgi?id=140323
+
+        Reviewed by Darin Adler.
+
+        Log navigation types using DiagnosticLoggingClient to help us understand
+        what types of navigations are common and give us an estimate on the
+        total number of navigations.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::logNavigation):
+        (WebCore::FrameLoader::loadWithDocumentLoader):
+        (WebCore::logNavigationWithFeatureCounter): Deleted.
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::navigationKey):
+        * page/DiagnosticLoggingKeys.h:
+
 2015-01-12  Brian J. Burg  <b...@cs.washington.edu>
 
         Web Inspector: ASSERT under WebCore::InspectorResourceAgent::loadResource

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (178297 => 178298)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2015-01-12 22:02:56 UTC (rev 178297)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2015-01-12 22:30:59 UTC (rev 178298)
@@ -1377,37 +1377,50 @@
     loadWithDocumentLoader(newDocumentLoader, type, 0, AllowNavigationToInvalidURL::Yes);
 }
 
-static void logNavigationWithFeatureCounter(Page* page, FrameLoadType type)
+static void logNavigation(MainFrame& frame, FrameLoadType type)
 {
-    const char* key;
+    const char* featureCounterKey;
+    String navigationDescription;
     switch (type) {
     case FrameLoadType::Standard:
-        key = FeatureCounterNavigationStandardKey;
+        featureCounterKey = FeatureCounterNavigationStandardKey;
+        navigationDescription = ASCIILiteral("standard");
         break;
     case FrameLoadType::Back:
-        key = FeatureCounterNavigationBackKey;
+        featureCounterKey = FeatureCounterNavigationBackKey;
+        navigationDescription = ASCIILiteral("back");
         break;
     case FrameLoadType::Forward:
-        key = FeatureCounterNavigationForwardKey;
+        featureCounterKey = FeatureCounterNavigationForwardKey;
+        navigationDescription = ASCIILiteral("forward");
         break;
     case FrameLoadType::IndexedBackForward:
-        key = FeatureCounterNavigationIndexedBackForwardKey;
+        featureCounterKey = FeatureCounterNavigationIndexedBackForwardKey;
+        navigationDescription = ASCIILiteral("indexedBackForward");
         break;
     case FrameLoadType::Reload:
-        key = FeatureCounterNavigationReloadKey;
+        featureCounterKey = FeatureCounterNavigationReloadKey;
+        navigationDescription = ASCIILiteral("reload");
         break;
     case FrameLoadType::Same:
-        key = FeatureCounterNavigationSameKey;
+        featureCounterKey = FeatureCounterNavigationSameKey;
+        navigationDescription = ASCIILiteral("same");
         break;
     case FrameLoadType::ReloadFromOrigin:
-        key = FeatureCounterNavigationReloadFromOriginKey;
+        featureCounterKey = FeatureCounterNavigationReloadFromOriginKey;
+        navigationDescription = ASCIILiteral("reloadFromOrigin");
         break;
     case FrameLoadType::Replace:
     case FrameLoadType::RedirectWithLockedBackForwardList:
         // Not logging those for now.
         return;
     }
-    FEATURE_COUNTER_INCREMENT_KEY(page, key);
+    if (frame.settings().diagnosticLoggingEnabled()) {
+        if (auto* client = frame.diagnosticLoggingClient())
+            client->logDiagnosticMessage(DiagnosticLoggingKeys::navigationKey(), navigationDescription);
+    }
+    // FIXME: Remove once DiagnosticLoggingClient works on iOS.
+    FEATURE_COUNTER_INCREMENT_KEY(frame.page(), featureCounterKey);
 }
 
 void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, PassRefPtr<FormState> prpFormState, AllowNavigationToInvalidURL allowNavigationToInvalidURL)
@@ -1430,7 +1443,7 @@
 
     // Log main frame navigation types.
     if (m_frame.isMainFrame())
-        logNavigationWithFeatureCounter(m_frame.page(), type);
+        logNavigation(static_cast<MainFrame&>(m_frame), type);
 
     policyChecker().setLoadType(type);
     RefPtr<FormState> formState = prpFormState;

Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp (178297 => 178298)


--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2015-01-12 22:02:56 UTC (rev 178297)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2015-01-12 22:30:59 UTC (rev 178298)
@@ -93,5 +93,10 @@
     return WTF::ASCIILiteral("engineFailedToLoad");
 }
 
+WTF::String DiagnosticLoggingKeys::navigationKey()
+{
+    return WTF::ASCIILiteral("navigation");
 }
 
+}
+

Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.h (178297 => 178298)


--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.h	2015-01-12 22:02:56 UTC (rev 178297)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.h	2015-01-12 22:30:59 UTC (rev 178298)
@@ -43,6 +43,7 @@
     static String pageContainsAtLeastOneMediaEngineKey();
     static String pageLoadedKey();
     static String engineFailedToLoadKey();
+    static String navigationKey();
 
     // Success keys.
     static String passKey();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to