Changeset 114736 in webkit


Ignore:
Timestamp:
Apr 20, 2012 3:54:06 AM (12 years ago)
Author:
sergio@webkit.org
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:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r114735 r114736  
     12012-04-20  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [GTK] Enable Web Timing
     4        https://bugs.webkit.org/show_bug.cgi?id=42432
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Removed some tests that are working fine now after adding Web
     9        Timing support.
     10
     11        * platform/gtk/test_expectations.txt:
     12
    1132012-04-20  Mikhail Naganov  <mnaganov@chromium.org>
    214
  • trunk/LayoutTests/platform/gtk/test_expectations.txt

    r114667 r114736  
    142142BUGWKGTK SKIP : fast/events/constructors/speech-recognition-event-constructor.html = FAIL
    143143
    144 // Web Timing is not enabled.
    145 BUGWK42432 : fast/dom/Window/window-properties-performance.html = FAIL
    146 BUGWK42432 : fast/dom/navigation-type-back-forward.html = FAIL
    147 BUGWK42432 : fast/dom/navigation-type-navigate.html = FAIL
    148 BUGWK42432 : fast/dom/navigation-type-reload.html = FAIL
    149 BUGWK42432 : fast/dom/webtiming.html = FAIL
    150 BUGWK42432 : fast/dom/webtiming-navigate-within-document.html = FAIL
    151 BUGWK42432 : fast/dom/webtiming-document-open.html = FAIL
    152 BUGWK42432 : http/tests/misc/webtiming-origins.html = FAIL
    153 BUGWK42432 : http/tests/misc/webtiming-one-redirect.php = FAIL
    154 BUGWK42432 : http/tests/misc/webtiming-slow-load.php = FAIL
    155 BUGWK42432 : http/tests/misc/webtiming-ssl.php = FAIL
    156 BUGWK42432 : http/tests/misc/webtiming-two-redirects.php = FAIL
     144// Web Timing issues.
     145BUGWKGTK : fast/dom/Window/window-properties-performance.html = FAIL
     146BUGWKGTK : http/tests/misc/webtiming-origins.html = FAIL
     147BUGWKGTK : http/tests/misc/webtiming-ssl.php = FAIL
    157148
    158149// FileSystem API is not supported.
  • trunk/Source/WebCore/ChangeLog

    r114734 r114736  
     12012-04-20  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [GTK] Enable Web Timing
     4        https://bugs.webkit.org/show_bug.cgi?id=42432
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Added WebTiming support to the GTK+ port. WebTiming allows
     9        developers to collect detailed network timing information per
     10        resource. It requires the new SoupMessage's "network-event"
     11        signal.
     12
     13        * GNUmakefile.am:
     14        * bindings/gobject/GNUmakefile.am:
     15        * platform/network/soup/ResourceHandleSoup.cpp:
     16        (WebCore):
     17        (WebCore::restartedCallback):
     18        (WebCore::sendRequestCallback):
     19        (WebCore::milisecondsSinceRequest):
     20        (WebCore::wroteBodyCallback):
     21        (WebCore::requestStartedCallback):
     22        (WebCore::networkEventCallback):
     23        (WebCore::startHTTPRequest):
     24        (WebCore::ResourceHandle::platformSetDefersLoading):
     25        (WebCore::ResourceHandle::defaultSession):
     26
    1272012-04-20  'Pavel Feldman'  <pfeldman@chromium.org>
    228
  • trunk/Source/WebCore/GNUmakefile.am

    r113560 r114736  
    640640webcore_cppflags += -DENABLE_DEVICE_ORIENTATION=1
    641641endif  # END ENABLE_DEVICE_ORIENTATION
     642
     643# ---
     644# Web Timing support
     645# ---
     646if ENABLE_WEB_TIMING
     647FEATURE_DEFINES += ENABLE_WEB_TIMING=1
     648webcore_cppflags += -DENABLE_WEB_TIMING=1
     649endif  # END ENABLE_WEB_TIMING
    642650
    643651DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h
  • trunk/Source/WebCore/bindings/gobject/GNUmakefile.am

    r111914 r114736  
    429429endif
    430430
     431
     432if ENABLE_WEB_TIMING
     433webkitgtk_built_h_api += \
     434        $(top_builddir)/DerivedSources/webkit/WebKitDOMPerformance.h \
     435        $(top_builddir)/DerivedSources/webkit/WebKitDOMPerformanceNavigation.h \
     436        $(top_builddir)/DerivedSources/webkit/WebKitDOMPerformanceTiming.h
     437webkitgtk_gdom_built_sources += \
     438        DerivedSources/webkit/WebKitDOMPerformance.cpp \
     439        DerivedSources/webkit/WebKitDOMPerformancePrivate.h \
     440        DerivedSources/webkit/WebKitDOMPerformanceNavigation.cpp \
     441        DerivedSources/webkit/WebKitDOMPerformanceNavigationPrivate.h \
     442        DerivedSources/webkit/WebKitDOMPerformanceTiming.cpp \
     443        DerivedSources/webkit/WebKitDOMPerformanceTimingPrivate.h
     444endif
     445
    431446gdom_class_list := $(subst WebKitDOM,, $(filter-out %Private, $(basename $(notdir $(webkitgtk_gdom_built_sources)))))
    432447gdom_class_list += Custom EventTarget Object
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r113604 r114736  
    144144static void closeCallback(GObject*, GAsyncResult*, gpointer);
    145145static bool startNonHTTPRequest(ResourceHandle*, KURL);
     146#if ENABLE(WEB_TIMING)
     147static int  milisecondsSinceRequest(double requestTime);
     148#endif
    146149
    147150ResourceHandleInternal::~ResourceHandleInternal()
     
    220223        return;
    221224
     225#if ENABLE(WEB_TIMING)
     226    d->m_response.setResourceLoadTiming(ResourceLoadTiming::create());
     227    d->m_response.resourceLoadTiming()->requestTime = monotonicallyIncreasingTime();
     228#endif
     229
    222230    // Update the first party in case the base URL changed with the redirect
    223231    String firstPartyString = request.firstPartyForCookies().string();
     
    306314        return;
    307315    }
     316
     317#if ENABLE(WEB_TIMING)
     318    if (d->m_response.resourceLoadTiming())
     319        d->m_response.resourceLoadTiming()->receiveHeadersEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
     320#endif
    308321
    309322    GOwnPtr<GError> error;
     
    445458}
    446459
     460#if ENABLE(WEB_TIMING)
     461static int milisecondsSinceRequest(double requestTime)
     462{
     463    return static_cast<int>((monotonicallyIncreasingTime() - requestTime) * 1000.0);
     464}
     465
     466static void wroteBodyCallback(SoupMessage*, gpointer data)
     467{
     468    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
     469    if (!handle)
     470        return;
     471
     472    ResourceHandleInternal* d = handle->getInternal();
     473    if (!d->m_response.resourceLoadTiming())
     474        return;
     475
     476    d->m_response.resourceLoadTiming()->sendEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
     477}
     478
     479static void requestStartedCallback(SoupSession*, SoupMessage* soupMessage, SoupSocket*, gpointer data)
     480{
     481    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
     482    if (!handle)
     483        return;
     484
     485    ResourceHandleInternal* d = handle->getInternal();
     486    if (!d->m_response.resourceLoadTiming())
     487        return;
     488
     489    d->m_response.resourceLoadTiming()->sendStart = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
     490    if (d->m_response.resourceLoadTiming()->sslStart != -1) {
     491        // WebCore/inspector/front-end/RequestTimingView.js assumes
     492        // that SSL time is included in connection time so must
     493        // substract here the SSL delta that will be added later (see
     494        // WebInspector.RequestTimingView.createTimingTable in the
     495        // file above for more details).
     496        d->m_response.resourceLoadTiming()->sendStart -=
     497            d->m_response.resourceLoadTiming()->sslEnd - d->m_response.resourceLoadTiming()->sslStart;
     498    }
     499}
     500
     501static void networkEventCallback(SoupMessage*, GSocketClientEvent event, GIOStream*, gpointer data)
     502{
     503    ResourceHandle* handle = static_cast<ResourceHandle*>(data);
     504    if (!handle)
     505        return;
     506    ResourceHandleInternal* d = handle->getInternal();
     507    if (d->m_cancelled)
     508        return;
     509
     510    int deltaTime = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
     511    switch (event) {
     512    case G_SOCKET_CLIENT_RESOLVING:
     513        d->m_response.resourceLoadTiming()->dnsStart = deltaTime;
     514        break;
     515    case G_SOCKET_CLIENT_RESOLVED:
     516        d->m_response.resourceLoadTiming()->dnsEnd = deltaTime;
     517        break;
     518    case G_SOCKET_CLIENT_CONNECTING:
     519        d->m_response.resourceLoadTiming()->connectStart = deltaTime;
     520        if (d->m_response.resourceLoadTiming()->dnsStart != -1)
     521            // WebCore/inspector/front-end/RequestTimingView.js assumes
     522            // that DNS time is included in connection time so must
     523            // substract here the DNS delta that will be added later (see
     524            // WebInspector.RequestTimingView.createTimingTable in the
     525            // file above for more details).
     526            d->m_response.resourceLoadTiming()->connectStart -=
     527                d->m_response.resourceLoadTiming()->dnsEnd - d->m_response.resourceLoadTiming()->dnsStart;
     528        break;
     529    case G_SOCKET_CLIENT_CONNECTED:
     530        // Web Timing considers that connection time involves dns, proxy & TLS negotiation...
     531        // so we better pick G_SOCKET_CLIENT_COMPLETE for connectEnd
     532        break;
     533    case G_SOCKET_CLIENT_PROXY_NEGOTIATING:
     534        d->m_response.resourceLoadTiming()->proxyStart = deltaTime;
     535        break;
     536    case G_SOCKET_CLIENT_PROXY_NEGOTIATED:
     537        d->m_response.resourceLoadTiming()->proxyEnd = deltaTime;
     538        break;
     539    case G_SOCKET_CLIENT_TLS_HANDSHAKING:
     540        d->m_response.resourceLoadTiming()->sslStart = deltaTime;
     541        break;
     542    case G_SOCKET_CLIENT_TLS_HANDSHAKED:
     543        d->m_response.resourceLoadTiming()->sslEnd = deltaTime;
     544        break;
     545    case G_SOCKET_CLIENT_COMPLETE:
     546        d->m_response.resourceLoadTiming()->connectEnd = deltaTime;
     547        break;
     548    default:
     549        ASSERT_NOT_REACHED();
     550        break;
     551    }
     552}
     553#endif
     554
    447555static bool startHTTPRequest(ResourceHandle* handle)
    448556{
     
    479587    g_signal_connect(soupMessage, "restarted", G_CALLBACK(restartedCallback), handle);
    480588    g_signal_connect(soupMessage, "wrote-body-data", G_CALLBACK(wroteBodyDataCallback), handle);
     589
     590#if ENABLE(WEB_TIMING)
     591    g_signal_connect(soupMessage, "network-event", G_CALLBACK(networkEventCallback), handle);
     592    g_signal_connect(soupMessage, "wrote-body", G_CALLBACK(wroteBodyCallback), handle);
     593    g_object_set_data(G_OBJECT(soupMessage), "handle", handle);
     594#endif
    481595
    482596    String firstPartyString = request.firstPartyForCookies().string();
     
    499613    handle->ref();
    500614
     615#if ENABLE(WEB_TIMING)
     616    d->m_response.setResourceLoadTiming(ResourceLoadTiming::create());
     617#endif
     618
    501619    // Make sure we have an Accept header for subresources; some sites
    502620    // want this to serve some of their subresources
     
    515633    // Send the request only if it's not been explicitly deferred.
    516634    if (!d->m_defersLoading) {
     635#if ENABLE(WEB_TIMING)
     636        d->m_response.resourceLoadTiming()->requestTime = monotonicallyIncreasingTime();
     637#endif
    517638        d->m_cancellable = adoptGRef(g_cancellable_new());
    518639        soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, handle);
     
    594715    // soon as the failure event is fired.
    595716    if (!hasBeenSent(this) && d->m_soupRequest) {
     717#if ENABLE(WEB_TIMING)
     718        if (d->m_response.resourceLoadTiming())
     719            d->m_response.resourceLoadTiming()->requestTime = monotonicallyIncreasingTime();
     720#endif
    596721        d->m_cancellable = adoptGRef(g_cancellable_new());
    597722        soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, this);
     
    761886                     SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
    762887                     NULL);
     888#if ENABLE(WEB_TIMING)
     889        g_signal_connect(G_OBJECT(session), "request-started", G_CALLBACK(requestStartedCallback), 0);
     890#endif
    763891    }
    764892
  • trunk/Tools/ChangeLog

    r114733 r114736  
     12012-04-20  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [GTK] Enable Web Timing
     4        https://bugs.webkit.org/show_bug.cgi?id=42432
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Build web timing by default whenever build-webkit is used.
     9
     10        * Scripts/build-webkit:
     11
    1122012-04-20  Kamil Blank  <k.blank@samsung.com>
    213
  • trunk/Tools/Scripts/build-webkit

    r114257 r114736  
    363363
    364364    { option => "web-timing", desc => "Toggle Web Timing support",
    365       define => "ENABLE_WEB_TIMING", default => isBlackBerry(), value=> \$webTimingSupport },
     365      define => "ENABLE_WEB_TIMING", default => (isBlackBerry() || isGtk()), value=> \$webTimingSupport },
    366366
    367367    { option => "workers", desc => "Toggle Web Workers support",
Note: See TracChangeset for help on using the changeset viewer.