Changeset 62984 in webkit


Ignore:
Timestamp:
Jul 9, 2010 1:16:03 PM (14 years ago)
Author:
tonyg@chromium.org
Message:

2010-07-08 Tony Gentilcore <tonyg@chromium.org>

Reviewed by Nate Chapin.

Implement unloadEventEnd, loadEventStart, and loadEventEnd for Web Timing
https://bugs.webkit.org/show_bug.cgi?id=41332

Expectations are set to FAIL because disabled by default. Passes with --web-timing.

  • fast/dom/script-tests/webtiming.js: Added. (sleepFiftyMilliseconds): (shouldBeGreaterThanOrEqual): (checkTimingBeforeLoad): (checkWebTimingOnLoad): (checkWebTimingAfterLoad):
  • fast/dom/webtiming-expected.txt: Added.
  • fast/dom/webtiming.html: Added.

2010-07-08 Tony Gentilcore <tonyg@chromium.org>

Reviewed by Nate Chapin.

Implement unloadEventEnd, loadEventStart, and loadEventEnd for Web Timing
https://bugs.webkit.org/show_bug.cgi?id=41332

Test: fast/dom/webtiming.html

  • loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): (WebCore::FrameLoader::loadWithDocumentLoader):
  • loader/FrameLoader.h: (WebCore::FrameLoader::frameLoadTimeline):
  • loader/FrameLoaderTypes.h: (WebCore::FrameLoadTimeline::FrameLoadTimeline):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::dispatchLoadEvent):
  • page/Timing.cpp: (WebCore::Timing::navigationStart): (WebCore::Timing::unloadEventEnd): (WebCore::Timing::loadEventStart): (WebCore::Timing::loadEventEnd):
  • page/Timing.h:
  • page/Timing.idl:
Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62982 r62984  
     12010-07-08  Tony Gentilcore  <tonyg@chromium.org>
     2
     3        Reviewed by Nate Chapin.
     4
     5        Implement unloadEventEnd, loadEventStart, and loadEventEnd for Web Timing
     6        https://bugs.webkit.org/show_bug.cgi?id=41332
     7
     8        Expectations are set to FAIL because disabled by default. Passes with --web-timing.
     9
     10        * fast/dom/script-tests/webtiming.js: Added.
     11        (sleepFiftyMilliseconds):
     12        (shouldBeGreaterThanOrEqual):
     13        (checkTimingBeforeLoad):
     14        (checkWebTimingOnLoad):
     15        (checkWebTimingAfterLoad):
     16        * fast/dom/webtiming-expected.txt: Added.
     17        * fast/dom/webtiming.html: Added.
     18
    1192010-07-09  Aaron Boodman  <aa@chromium.org>
    220
  • trunk/WebCore/ChangeLog

    r62978 r62984  
     12010-07-08  Tony Gentilcore  <tonyg@chromium.org>
     2
     3        Reviewed by Nate Chapin.
     4
     5        Implement unloadEventEnd, loadEventStart, and loadEventEnd for Web Timing
     6        https://bugs.webkit.org/show_bug.cgi?id=41332
     7
     8        Test: fast/dom/webtiming.html
     9
     10        * loader/FrameLoader.cpp:
     11        (WebCore::FrameLoader::stopLoading):
     12        (WebCore::FrameLoader::loadWithDocumentLoader):
     13        * loader/FrameLoader.h:
     14        (WebCore::FrameLoader::frameLoadTimeline):
     15        * loader/FrameLoaderTypes.h:
     16        (WebCore::FrameLoadTimeline::FrameLoadTimeline):
     17        * page/DOMWindow.cpp:
     18        (WebCore::DOMWindow::dispatchLoadEvent):
     19        * page/Timing.cpp:
     20        (WebCore::Timing::navigationStart):
     21        (WebCore::Timing::unloadEventEnd):
     22        (WebCore::Timing::loadEventStart):
     23        (WebCore::Timing::loadEventEnd):
     24        * page/Timing.h:
     25        * page/Timing.idl:
     26
    1272010-07-09  Dumitru Daniliuc  <dumi@chromium.org>
    228
  • trunk/WebCore/loader/FrameLoader.cpp

    r62551 r62984  
    450450                    if (!m_frame->document()->inPageCache())
    451451                        m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document());
     452                    m_frameLoadTimeline.unloadEventEnd = currentTime();
    452453                }
    453454                m_pageDismissalEventBeingDispatched = false;
     
    14991500    if (m_pageDismissalEventBeingDispatched)
    15001501        return;
     1502
     1503    m_frameLoadTimeline = FrameLoadTimeline();
    15011504
    15021505    policyChecker()->setLoadType(type);
  • trunk/WebCore/loader/FrameLoader.h

    r61801 r62984  
    194194
    195195    FrameLoadType loadType() const;
     196    FrameLoadTimeline* frameLoadTimeline() { return &m_frameLoadTimeline; }
     197
    196198    CachePolicy subresourceCachePolicy() const;
    197199
     
    445447    FrameState m_state;
    446448    FrameLoadType m_loadType;
     449    FrameLoadTimeline m_frameLoadTimeline;
    447450
    448451    // Document loaders for the three phases of frame loading. Note that while
  • trunk/WebCore/loader/FrameLoaderTypes.h

    r59596 r62984  
    5959        FrameLoadTypeReloadFromOrigin,
    6060        FrameLoadTypeBackWMLDeckNotAccessible
     61    };
     62
     63    struct FrameLoadTimeline {
     64        FrameLoadTimeline()
     65            : unloadEventEnd(0)
     66            , loadEventStart(0)
     67            , loadEventEnd(0)
     68        {
     69        }
     70
     71        double unloadEventEnd;
     72        double loadEventStart;
     73        double loadEventEnd;
    6174    };
    6275
  • trunk/WebCore/page/DOMWindow.cpp

    r62424 r62984  
    7979#include "WebKitPoint.h"
    8080#include <algorithm>
     81#include <wtf/CurrentTime.h>
     82#include <wtf/MathExtras.h>
    8183#include <wtf/text/CString.h>
    82 #include <wtf/MathExtras.h>
    8384
    8485using std::min;
     
    14291430void DOMWindow::dispatchLoadEvent()
    14301431{
     1432    if (m_frame)
     1433        m_frame->loader()->frameLoadTimeline()->loadEventStart = currentTime();
    14311434    dispatchEvent(Event::create(eventNames().loadEvent, false, false), document());
     1435    if (m_frame)
     1436        m_frame->loader()->frameLoadTimeline()->loadEventEnd = currentTime();
    14321437
    14331438    // For load events, send a separate load event to the enclosing frame only.
  • trunk/WebCore/page/Timing.cpp

    r62357 r62984  
    5353}
    5454
    55 unsigned long Timing::navigationStart() const
     55unsigned long long Timing::navigationStart() const
    5656{
    5757    if (!m_frame)
     
    6161}
    6262
     63unsigned long long Timing::unloadEventEnd() const
     64{
     65    if (!m_frame)
     66        return 0;
     67
     68    return static_cast<unsigned long long>(m_frame->loader()->frameLoadTimeline()->unloadEventEnd * 1000);
     69}
     70
     71unsigned long long Timing::loadEventStart() const
     72{
     73    if (!m_frame)
     74        return 0;
     75
     76    return static_cast<unsigned long long>(m_frame->loader()->frameLoadTimeline()->loadEventStart * 1000);
     77}
     78
     79unsigned long long Timing::loadEventEnd() const
     80{
     81    if (!m_frame)
     82        return 0;
     83
     84    return static_cast<unsigned long long>(m_frame->loader()->frameLoadTimeline()->loadEventEnd * 1000);
     85}
     86
    6387} // namespace WebCore
    6488
  • trunk/WebCore/page/Timing.h

    r62357 r62984  
    4848    void disconnectFrame();
    4949
    50     unsigned long navigationStart() const;
     50    unsigned long long navigationStart() const;
     51    unsigned long long unloadEventEnd() const;
     52    unsigned long long loadEventStart() const;
     53    unsigned long long loadEventEnd() const;
    5154
    5255private:
  • trunk/WebCore/page/Timing.idl

    r62357 r62984  
    3333    // See: http://dev.w3.org/2006/webapi/WebTiming/
    3434    interface [Conditional=WEB_TIMING, OmitConstructor] Timing {
    35         readonly attribute unsigned long navigationStart;
    3635        // FIXME: Implement remainder of interface.
     36        readonly attribute unsigned long long navigationStart;
     37        // readonly attribute unsigned long long fetchStart;
     38        readonly attribute unsigned long long unloadEventEnd;
     39        // readonly attribute unsigned long long redirectStart;
     40        // readonly attribute unsigned long long redirectEnd;
     41        // readonly attribute unsigned long long domainLookupStart;
     42        // readonly attribute unsigned long long domainLookupEnd;
     43        // readonly attribute unsigned long long connectStart;
     44        // readonly attribute unsigned long long connectEnd;
     45        // readonly attribute unsigned long long requestStart;
     46        // readonly attribute unsigned long long requestEnd;
     47        // readonly attribute unsigned long long responseStart;
     48        // readonly attribute unsigned long long responseEnd;
     49        readonly attribute unsigned long long loadEventStart;
     50        readonly attribute unsigned long long loadEventEnd;
    3751    };
    3852
Note: See TracChangeset for help on using the changeset viewer.