Title: [114736] trunk
Revision
114736
Author
[email protected]
Date
2012-04-20 03:54:06 -0700 (Fri, 20 Apr 2012)

Log Message

[GTK] Enable Web Timing
https://bugs.webkit.org/show_bug.cgi?id=42432

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Added WebTiming support to the GTK+ port. WebTiming allows
developers to collect detailed network timing information per
resource. It requires the new SoupMessage's "network-event"
signal.

* GNUmakefile.am:
* bindings/gobject/GNUmakefile.am:
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore):
(WebCore::restartedCallback):
(WebCore::sendRequestCallback):
(WebCore::milisecondsSinceRequest):
(WebCore::wroteBodyCallback):
(WebCore::requestStartedCallback):
(WebCore::networkEventCallback):
(WebCore::startHTTPRequest):
(WebCore::ResourceHandle::platformSetDefersLoading):
(WebCore::ResourceHandle::defaultSession):

Tools:

Build web timing by default whenever build-webkit is used.

* Scripts/build-webkit:

LayoutTests:

Removed some tests that are working fine now after adding Web
Timing support.

* platform/gtk/test_expectations.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114735 => 114736)


--- trunk/LayoutTests/ChangeLog	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/LayoutTests/ChangeLog	2012-04-20 10:54:06 UTC (rev 114736)
@@ -1,3 +1,15 @@
+2012-04-20  Sergio Villar Senin  <[email protected]>
+
+        [GTK] Enable Web Timing
+        https://bugs.webkit.org/show_bug.cgi?id=42432
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Removed some tests that are working fine now after adding Web
+        Timing support.
+
+        * platform/gtk/test_expectations.txt:
+
 2012-04-20  Mikhail Naganov  <[email protected]>
 
         [Chromium] Unreviewed test expectations update.

Modified: trunk/LayoutTests/platform/gtk/test_expectations.txt (114735 => 114736)


--- trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-04-20 10:54:06 UTC (rev 114736)
@@ -141,19 +141,10 @@
 // Speech _javascript_ API is not yet enabled.
 BUGWKGTK SKIP : fast/events/constructors/speech-recognition-event-constructor.html = FAIL
 
-// Web Timing is not enabled.
-BUGWK42432 : fast/dom/Window/window-properties-performance.html = FAIL
-BUGWK42432 : fast/dom/navigation-type-back-forward.html = FAIL
-BUGWK42432 : fast/dom/navigation-type-navigate.html = FAIL
-BUGWK42432 : fast/dom/navigation-type-reload.html = FAIL
-BUGWK42432 : fast/dom/webtiming.html = FAIL
-BUGWK42432 : fast/dom/webtiming-navigate-within-document.html = FAIL
-BUGWK42432 : fast/dom/webtiming-document-open.html = FAIL
-BUGWK42432 : http/tests/misc/webtiming-origins.html = FAIL
-BUGWK42432 : http/tests/misc/webtiming-one-redirect.php = FAIL
-BUGWK42432 : http/tests/misc/webtiming-slow-load.php = FAIL
-BUGWK42432 : http/tests/misc/webtiming-ssl.php = FAIL
-BUGWK42432 : http/tests/misc/webtiming-two-redirects.php = FAIL
+// Web Timing issues.
+BUGWKGTK : fast/dom/Window/window-properties-performance.html = FAIL
+BUGWKGTK : http/tests/misc/webtiming-origins.html = FAIL
+BUGWKGTK : http/tests/misc/webtiming-ssl.php = FAIL
 
 // FileSystem API is not supported.
 BUGWKGTK SKIP : fast/filesystem = FAIL

Modified: trunk/Source/WebCore/ChangeLog (114735 => 114736)


--- trunk/Source/WebCore/ChangeLog	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/Source/WebCore/ChangeLog	2012-04-20 10:54:06 UTC (rev 114736)
@@ -1,3 +1,29 @@
+2012-04-20  Sergio Villar Senin  <[email protected]>
+
+        [GTK] Enable Web Timing
+        https://bugs.webkit.org/show_bug.cgi?id=42432
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Added WebTiming support to the GTK+ port. WebTiming allows
+        developers to collect detailed network timing information per
+        resource. It requires the new SoupMessage's "network-event"
+        signal.
+
+        * GNUmakefile.am:
+        * bindings/gobject/GNUmakefile.am:
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore):
+        (WebCore::restartedCallback):
+        (WebCore::sendRequestCallback):
+        (WebCore::milisecondsSinceRequest):
+        (WebCore::wroteBodyCallback):
+        (WebCore::requestStartedCallback):
+        (WebCore::networkEventCallback):
+        (WebCore::startHTTPRequest):
+        (WebCore::ResourceHandle::platformSetDefersLoading):
+        (WebCore::ResourceHandle::defaultSession):
+
 2012-04-20  'Pavel Feldman'  <[email protected]>
 
         Not reviewed: fixed chromium sanity tests for inspector via assigning last path component

Modified: trunk/Source/WebCore/GNUmakefile.am (114735 => 114736)


--- trunk/Source/WebCore/GNUmakefile.am	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/Source/WebCore/GNUmakefile.am	2012-04-20 10:54:06 UTC (rev 114736)
@@ -640,6 +640,14 @@
 webcore_cppflags += -DENABLE_DEVICE_ORIENTATION=1
 endif  # END ENABLE_DEVICE_ORIENTATION
 
+# ---
+# Web Timing support
+# ---
+if ENABLE_WEB_TIMING
+FEATURE_DEFINES += ENABLE_WEB_TIMING=1
+webcore_cppflags += -DENABLE_WEB_TIMING=1
+endif  # END ENABLE_WEB_TIMING
+
 DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h
 DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl
 	$(AM_V_GEN)

Modified: trunk/Source/WebCore/bindings/gobject/GNUmakefile.am (114735 => 114736)


--- trunk/Source/WebCore/bindings/gobject/GNUmakefile.am	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/Source/WebCore/bindings/gobject/GNUmakefile.am	2012-04-20 10:54:06 UTC (rev 114736)
@@ -428,6 +428,21 @@
 	DerivedSources/webkit/WebKitDOMHTMLPropertiesCollectionPrivate.h
 endif
 
+
+if ENABLE_WEB_TIMING
+webkitgtk_built_h_api += \
+	$(top_builddir)/DerivedSources/webkit/WebKitDOMPerformance.h \
+	$(top_builddir)/DerivedSources/webkit/WebKitDOMPerformanceNavigation.h \
+	$(top_builddir)/DerivedSources/webkit/WebKitDOMPerformanceTiming.h
+webkitgtk_gdom_built_sources += \
+	DerivedSources/webkit/WebKitDOMPerformance.cpp \
+	DerivedSources/webkit/WebKitDOMPerformancePrivate.h \
+	DerivedSources/webkit/WebKitDOMPerformanceNavigation.cpp \
+	DerivedSources/webkit/WebKitDOMPerformanceNavigationPrivate.h \
+	DerivedSources/webkit/WebKitDOMPerformanceTiming.cpp \
+	DerivedSources/webkit/WebKitDOMPerformanceTimingPrivate.h
+endif
+
 gdom_class_list := $(subst WebKitDOM,, $(filter-out %Private, $(basename $(notdir $(webkitgtk_gdom_built_sources)))))
 gdom_class_list += Custom EventTarget Object
 DerivedSources/webkit/webkitdom.h: $(WebCore)/bindings/scripts/gobject-generate-headers.pl $(WebCore)/bindings/gobject/GNUmakefile.am

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (114735 => 114736)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-04-20 10:54:06 UTC (rev 114736)
@@ -143,6 +143,9 @@
 static void readCallback(GObject*, GAsyncResult*, gpointer);
 static void closeCallback(GObject*, GAsyncResult*, gpointer);
 static bool startNonHTTPRequest(ResourceHandle*, KURL);
+#if ENABLE(WEB_TIMING)
+static int  milisecondsSinceRequest(double requestTime);
+#endif
 
 ResourceHandleInternal::~ResourceHandleInternal()
 {
@@ -219,6 +222,11 @@
     if (d->m_cancelled)
         return;
 
+#if ENABLE(WEB_TIMING)
+    d->m_response.setResourceLoadTiming(ResourceLoadTiming::create());
+    d->m_response.resourceLoadTiming()->requestTime = monotonicallyIncreasingTime();
+#endif
+
     // Update the first party in case the base URL changed with the redirect
     String firstPartyString = request.firstPartyForCookies().string();
     if (!firstPartyString.isEmpty()) {
@@ -306,6 +314,11 @@
         return;
     }
 
+#if ENABLE(WEB_TIMING)
+    if (d->m_response.resourceLoadTiming())
+        d->m_response.resourceLoadTiming()->receiveHeadersEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
+#endif
+
     GOwnPtr<GError> error;
     GInputStream* in = soup_request_send_finish(d->m_soupRequest.get(), res, &error.outPtr());
     if (error) {
@@ -444,6 +457,101 @@
     return true;
 }
 
+#if ENABLE(WEB_TIMING)
+static int milisecondsSinceRequest(double requestTime)
+{
+    return static_cast<int>((monotonicallyIncreasingTime() - requestTime) * 1000.0);
+}
+
+static void wroteBodyCallback(SoupMessage*, gpointer data)
+{
+    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
+    if (!handle)
+        return;
+
+    ResourceHandleInternal* d = handle->getInternal();
+    if (!d->m_response.resourceLoadTiming())
+        return;
+
+    d->m_response.resourceLoadTiming()->sendEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
+}
+
+static void requestStartedCallback(SoupSession*, SoupMessage* soupMessage, SoupSocket*, gpointer data)
+{
+    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
+    if (!handle)
+        return;
+
+    ResourceHandleInternal* d = handle->getInternal();
+    if (!d->m_response.resourceLoadTiming())
+        return;
+
+    d->m_response.resourceLoadTiming()->sendStart = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
+    if (d->m_response.resourceLoadTiming()->sslStart != -1) {
+        // WebCore/inspector/front-end/RequestTimingView.js assumes
+        // that SSL time is included in connection time so must
+        // substract here the SSL delta that will be added later (see
+        // WebInspector.RequestTimingView.createTimingTable in the
+        // file above for more details).
+        d->m_response.resourceLoadTiming()->sendStart -=
+            d->m_response.resourceLoadTiming()->sslEnd - d->m_response.resourceLoadTiming()->sslStart;
+    }
+}
+
+static void networkEventCallback(SoupMessage*, GSocketClientEvent event, GIOStream*, gpointer data)
+{
+    ResourceHandle* handle = static_cast<ResourceHandle*>(data);
+    if (!handle)
+        return;
+    ResourceHandleInternal* d = handle->getInternal();
+    if (d->m_cancelled)
+        return;
+
+    int deltaTime = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
+    switch (event) {
+    case G_SOCKET_CLIENT_RESOLVING:
+        d->m_response.resourceLoadTiming()->dnsStart = deltaTime;
+        break;
+    case G_SOCKET_CLIENT_RESOLVED:
+        d->m_response.resourceLoadTiming()->dnsEnd = deltaTime;
+        break;
+    case G_SOCKET_CLIENT_CONNECTING:
+        d->m_response.resourceLoadTiming()->connectStart = deltaTime;
+        if (d->m_response.resourceLoadTiming()->dnsStart != -1)
+            // WebCore/inspector/front-end/RequestTimingView.js assumes
+            // that DNS time is included in connection time so must
+            // substract here the DNS delta that will be added later (see
+            // WebInspector.RequestTimingView.createTimingTable in the
+            // file above for more details).
+            d->m_response.resourceLoadTiming()->connectStart -=
+                d->m_response.resourceLoadTiming()->dnsEnd - d->m_response.resourceLoadTiming()->dnsStart;
+        break;
+    case G_SOCKET_CLIENT_CONNECTED:
+        // Web Timing considers that connection time involves dns, proxy & TLS negotiation...
+        // so we better pick G_SOCKET_CLIENT_COMPLETE for connectEnd
+        break;
+    case G_SOCKET_CLIENT_PROXY_NEGOTIATING:
+        d->m_response.resourceLoadTiming()->proxyStart = deltaTime;
+        break;
+    case G_SOCKET_CLIENT_PROXY_NEGOTIATED:
+        d->m_response.resourceLoadTiming()->proxyEnd = deltaTime;
+        break;
+    case G_SOCKET_CLIENT_TLS_HANDSHAKING:
+        d->m_response.resourceLoadTiming()->sslStart = deltaTime;
+        break;
+    case G_SOCKET_CLIENT_TLS_HANDSHAKED:
+        d->m_response.resourceLoadTiming()->sslEnd = deltaTime;
+        break;
+    case G_SOCKET_CLIENT_COMPLETE:
+        d->m_response.resourceLoadTiming()->connectEnd = deltaTime;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+}
+#endif
+
 static bool startHTTPRequest(ResourceHandle* handle)
 {
     ASSERT(handle);
@@ -479,6 +587,12 @@
     g_signal_connect(soupMessage, "restarted", G_CALLBACK(restartedCallback), handle);
     g_signal_connect(soupMessage, "wrote-body-data", G_CALLBACK(wroteBodyDataCallback), handle);
 
+#if ENABLE(WEB_TIMING)
+    g_signal_connect(soupMessage, "network-event", G_CALLBACK(networkEventCallback), handle);
+    g_signal_connect(soupMessage, "wrote-body", G_CALLBACK(wroteBodyCallback), handle);
+    g_object_set_data(G_OBJECT(soupMessage), "handle", handle);
+#endif
+
     String firstPartyString = request.firstPartyForCookies().string();
     if (!firstPartyString.isEmpty()) {
         GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
@@ -498,6 +612,10 @@
     // balanced by a deref() in cleanupSoupRequestOperation, which should always run
     handle->ref();
 
+#if ENABLE(WEB_TIMING)
+    d->m_response.setResourceLoadTiming(ResourceLoadTiming::create());
+#endif
+
     // Make sure we have an Accept header for subresources; some sites
     // want this to serve some of their subresources
     if (!soup_message_headers_get_one(soupMessage->request_headers, "Accept"))
@@ -514,6 +632,9 @@
 
     // Send the request only if it's not been explicitly deferred.
     if (!d->m_defersLoading) {
+#if ENABLE(WEB_TIMING)
+        d->m_response.resourceLoadTiming()->requestTime = monotonicallyIncreasingTime();
+#endif
         d->m_cancellable = adoptGRef(g_cancellable_new());
         soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, handle);
     }
@@ -593,6 +714,10 @@
     // simply check for d->m_scheduledFailure because it's cleared as
     // soon as the failure event is fired.
     if (!hasBeenSent(this) && d->m_soupRequest) {
+#if ENABLE(WEB_TIMING)
+        if (d->m_response.resourceLoadTiming())
+            d->m_response.resourceLoadTiming()->requestTime = monotonicallyIncreasingTime();
+#endif
         d->m_cancellable = adoptGRef(g_cancellable_new());
         soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, this);
         return;
@@ -760,6 +885,9 @@
                      SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
                      SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
                      NULL);
+#if ENABLE(WEB_TIMING)
+        g_signal_connect(G_OBJECT(session), "request-started", G_CALLBACK(requestStartedCallback), 0);
+#endif
     }
 
     return session;

Modified: trunk/Tools/ChangeLog (114735 => 114736)


--- trunk/Tools/ChangeLog	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/Tools/ChangeLog	2012-04-20 10:54:06 UTC (rev 114736)
@@ -1,3 +1,14 @@
+2012-04-20  Sergio Villar Senin  <[email protected]>
+
+        [GTK] Enable Web Timing
+        https://bugs.webkit.org/show_bug.cgi?id=42432
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Build web timing by default whenever build-webkit is used.
+
+        * Scripts/build-webkit:
+
 2012-04-20  Kamil Blank  <[email protected]>
 
         [EFL] Add missing reset for setAuthorAndUserStylesEnabled inside DRT.

Modified: trunk/Tools/Scripts/build-webkit (114735 => 114736)


--- trunk/Tools/Scripts/build-webkit	2012-04-20 10:28:14 UTC (rev 114735)
+++ trunk/Tools/Scripts/build-webkit	2012-04-20 10:54:06 UTC (rev 114736)
@@ -362,7 +362,7 @@
       define => "ENABLE_WEB_SOCKETS", default => 1, value=> \$webSocketsSupport },
 
     { option => "web-timing", desc => "Toggle Web Timing support",
-      define => "ENABLE_WEB_TIMING", default => isBlackBerry(), value=> \$webTimingSupport },
+      define => "ENABLE_WEB_TIMING", default => (isBlackBerry() || isGtk()), value=> \$webTimingSupport },
 
     { option => "workers", desc => "Toggle Web Workers support",
       define => "ENABLE_WORKERS", default => (isAppleWebKit() || isGtk() || isBlackBerry() || isEfl()), value => \$workersSupport },
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to