Changeset 120962 in webkit


Ignore:
Timestamp:
Jun 21, 2012 2:15:19 PM (12 years ago)
Author:
simonjam@chromium.org
Message:

[Resource Timing] Implement Resource Timing interface
https://bugs.webkit.org/show_bug.cgi?id=61152

This patch implements the Resource Timing interface. It doesn't do anything
useful, because nothing populates the timeline yet. There are also some gaps
in the implementation, which have been filed as bugs.

http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html

Reviewed by Tony Gentilcore.

No new tests. Feature is disabled on all platforms.

  • CMakeLists.txt:
  • DerivedSources.pri:
  • GNUmakefile.list.am:
  • Target.pri:
  • UseV8.cmake:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/v8/custom/V8PerformanceEntryCustom.cpp:

(WebCore):
(WebCore::toV8): Support PerformanceEntry polymorphism.

  • dom/EventNames.h:

(WebCore):

  • dom/EventTargetFactory.in:
  • page/Performance.cpp:

(WebCore::Performance::~Performance):
(WebCore):
(WebCore::Performance::interfaceName): Reqired for EventTarget.
(WebCore::Performance::scriptExecutionContext): Ditto.
(WebCore::Performance::webkitGetEntries): Return "resource" entries.
(WebCore::Performance::webkitGetEntriesByType): Ditto.
(WebCore::Performance::webkitGetEntriesByName): Ditto.
(WebCore::Performance::webkitClearResourceTimings): New.
(WebCore::Performance::webkitSetResourceTimingBufferSize): New. Unimplemented.
(WebCore::Performance::addResourceTiming): This is how resources in WebCore will report to the timeline.
(WebCore::Performance::eventTargetData): Required for EventTarget.
(WebCore::Performance::ensureEventTargetData): Ditto.

  • page/Performance.h:

(Performance):
(WebCore::Performance::refEventTarget):
(WebCore::Performance::derefEventTarget):

  • page/Performance.idl:
  • page/PerformanceEntry.cpp:

(WebCore::PerformanceEntry::~PerformanceEntry):
(WebCore):

  • page/PerformanceEntry.h:

(PerformanceEntry):
(WebCore::PerformanceEntry::isResource):

  • page/PerformanceEntry.idl:
  • page/PerformanceResourceTiming.cpp: Added.

(WebCore):
(WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
(WebCore::PerformanceResourceTiming::initiatorType):
(WebCore::PerformanceResourceTiming::redirectStart):
(WebCore::PerformanceResourceTiming::redirectEnd):
(WebCore::PerformanceResourceTiming::fetchStart):
(WebCore::PerformanceResourceTiming::domainLookupStart):
(WebCore::PerformanceResourceTiming::domainLookupEnd):
(WebCore::PerformanceResourceTiming::connectStart):
(WebCore::PerformanceResourceTiming::connectEnd):
(WebCore::PerformanceResourceTiming::secureConnectionStart):
(WebCore::PerformanceResourceTiming::requestStart):
(WebCore::PerformanceResourceTiming::responseStart):
(WebCore::PerformanceResourceTiming::responseEnd):
(WebCore::PerformanceResourceTiming::monotonicTimeToDocumentMilliseconds):
(WebCore::PerformanceResourceTiming::resourceTimeToMilliseconds):

  • page/PerformanceResourceTiming.h: Added.

(WebCore):
(PerformanceResourceTiming):
(WebCore::PerformanceResourceTiming::create):
(WebCore::PerformanceResourceTiming::isResource):

  • page/PerformanceResourceTiming.idl: Added.
Location:
trunk/Source/WebCore
Files:
1 added
19 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r120957 r120962  
    397397    page/PerformanceEntryList.idl
    398398    page/PerformanceNavigation.idl
     399    page/PerformanceResourceTiming.idl
    399400    page/PerformanceTiming.idl
    400401    page/Screen.idl
     
    10881089    page/PerformanceEntryList.cpp
    10891090    page/PerformanceNavigation.cpp
     1091    page/PerformanceResourceTiming.cpp
    10901092    page/PerformanceTiming.cpp
    10911093    page/PrintContext.cpp
  • trunk/Source/WebCore/ChangeLog

    r120960 r120962  
     12012-06-21  James Simonsen  <simonjam@chromium.org>
     2
     3        [Resource Timing] Implement Resource Timing interface
     4        https://bugs.webkit.org/show_bug.cgi?id=61152
     5
     6        This patch implements the Resource Timing interface. It doesn't do anything
     7        useful, because nothing populates the timeline yet. There are also some gaps
     8        in the implementation, which have been filed as bugs.
     9
     10        http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html
     11
     12        Reviewed by Tony Gentilcore.
     13
     14        No new tests. Feature is disabled on all platforms.
     15
     16        * CMakeLists.txt:
     17        * DerivedSources.pri:
     18        * GNUmakefile.list.am:
     19        * Target.pri:
     20        * UseV8.cmake:
     21        * WebCore.gypi:
     22        * WebCore.vcproj/WebCore.vcproj:
     23        * WebCore.xcodeproj/project.pbxproj:
     24        * bindings/v8/custom/V8PerformanceEntryCustom.cpp:
     25        (WebCore):
     26        (WebCore::toV8): Support PerformanceEntry polymorphism.
     27        * dom/EventNames.h:
     28        (WebCore):
     29        * dom/EventTargetFactory.in:
     30        * page/Performance.cpp:
     31        (WebCore::Performance::~Performance):
     32        (WebCore):
     33        (WebCore::Performance::interfaceName): Reqired for EventTarget.
     34        (WebCore::Performance::scriptExecutionContext): Ditto.
     35        (WebCore::Performance::webkitGetEntries): Return "resource" entries.
     36        (WebCore::Performance::webkitGetEntriesByType): Ditto.
     37        (WebCore::Performance::webkitGetEntriesByName): Ditto.
     38        (WebCore::Performance::webkitClearResourceTimings): New.
     39        (WebCore::Performance::webkitSetResourceTimingBufferSize): New. Unimplemented.
     40        (WebCore::Performance::addResourceTiming): This is how resources in WebCore will report to the timeline.
     41        (WebCore::Performance::eventTargetData): Required for EventTarget.
     42        (WebCore::Performance::ensureEventTargetData): Ditto.
     43        * page/Performance.h:
     44        (Performance):
     45        (WebCore::Performance::refEventTarget):
     46        (WebCore::Performance::derefEventTarget):
     47        * page/Performance.idl:
     48        * page/PerformanceEntry.cpp:
     49        (WebCore::PerformanceEntry::~PerformanceEntry):
     50        (WebCore):
     51        * page/PerformanceEntry.h:
     52        (PerformanceEntry):
     53        (WebCore::PerformanceEntry::isResource):
     54        * page/PerformanceEntry.idl:
     55        * page/PerformanceResourceTiming.cpp: Added.
     56        (WebCore):
     57        (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
     58        (WebCore::PerformanceResourceTiming::initiatorType):
     59        (WebCore::PerformanceResourceTiming::redirectStart):
     60        (WebCore::PerformanceResourceTiming::redirectEnd):
     61        (WebCore::PerformanceResourceTiming::fetchStart):
     62        (WebCore::PerformanceResourceTiming::domainLookupStart):
     63        (WebCore::PerformanceResourceTiming::domainLookupEnd):
     64        (WebCore::PerformanceResourceTiming::connectStart):
     65        (WebCore::PerformanceResourceTiming::connectEnd):
     66        (WebCore::PerformanceResourceTiming::secureConnectionStart):
     67        (WebCore::PerformanceResourceTiming::requestStart):
     68        (WebCore::PerformanceResourceTiming::responseStart):
     69        (WebCore::PerformanceResourceTiming::responseEnd):
     70        (WebCore::PerformanceResourceTiming::monotonicTimeToDocumentMilliseconds):
     71        (WebCore::PerformanceResourceTiming::resourceTimeToMilliseconds):
     72        * page/PerformanceResourceTiming.h: Added.
     73        (WebCore):
     74        (PerformanceResourceTiming):
     75        (WebCore::PerformanceResourceTiming::create):
     76        (WebCore::PerformanceResourceTiming::isResource):
     77        * page/PerformanceResourceTiming.idl: Added.
     78
    1792012-06-21  Hans Wennborg  <hans@chromium.org>
    280
  • trunk/Source/WebCore/DerivedSources.pri

    r120957 r120962  
    426426    $$PWD/page/PerformanceEntryList.idl \
    427427    $$PWD/page/PerformanceNavigation.idl \
     428    $$PWD/page/PerformanceResourceTiming.idl \
    428429    $$PWD/page/PerformanceTiming.idl \
    429430    $$PWD/page/Screen.idl \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r120957 r120962  
    958958        $(WebCore)/page/PerformanceEntryList.idl \
    959959        $(WebCore)/page/PerformanceNavigation.idl \
     960        $(WebCore)/page/PerformanceResourceTiming.idl \
    960961        $(WebCore)/page/PerformanceTiming.idl \
    961962        $(WebCore)/page/Screen.idl \
     
    30433044        Source/WebCore/page/PerformanceNavigation.cpp \
    30443045        Source/WebCore/page/PerformanceNavigation.h \
     3046        Source/WebCore/page/PerformanceResourceTiming.cpp \
     3047        Source/WebCore/page/PerformanceResourceTiming.h \
    30453048        Source/WebCore/page/PerformanceTiming.cpp \
    30463049        Source/WebCore/page/PerformanceTiming.h \
  • trunk/Source/WebCore/Target.pri

    r120929 r120962  
    209209        bindings/v8/custom/V8NodeListCustom.cpp \
    210210        bindings/v8/custom/V8PerformanceCustom.cpp \
     211        bindings/v8/custom/V8PerformanceEntryCustom.cpp \
    211212        bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
    212213        bindings/v8/custom/V8SQLTransactionCustom.cpp \
     
    10511052    page/PerformanceEntryList.cpp \
    10521053    page/PerformanceNavigation.cpp \
     1054    page/PerformanceResourceTiming.cpp \
    10531055    page/PerformanceTiming.cpp \
    10541056    page/PrintContext.cpp \
  • trunk/Source/WebCore/UseV8.cmake

    r120866 r120962  
    141141    bindings/v8/custom/V8NotificationCenterCustom.cpp
    142142    bindings/v8/custom/V8PerformanceCustom.cpp
     143    bindings/v8/custom/V8PerformanceEntryCustom.cpp
    143144    bindings/v8/custom/V8PopStateEventCustom.cpp
    144145    bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
  • trunk/Source/WebCore/WebCore.gypi

    r120957 r120962  
    11681168            'page/PerformanceEntryList.idl',
    11691169            'page/PerformanceNavigation.idl',
     1170            'page/PerformanceResourceTiming.idl',
    11701171            'page/PerformanceTiming.idl',
    11711172            'page/PointerLock.idl',
     
    23362337            'bindings/v8/custom/V8NotificationCenterCustom.cpp',
    23372338            'bindings/v8/custom/V8PerformanceCustom.cpp',
     2339            'bindings/v8/custom/V8PerformanceEntryCustom.cpp',
    23382340            'bindings/v8/custom/V8PopStateEventCustom.cpp',
    23392341            'bindings/v8/custom/V8SQLResultSetRowListCustom.cpp',
     
    30733075            'page/PerformanceNavigation.cpp',
    30743076            'page/PerformanceNavigation.h',
     3077            'page/PerformanceResourceTiming.cpp',
     3078            'page/PerformanceResourceTiming.h',
    30753079            'page/PerformanceTiming.cpp',
    30763080            'page/PerformanceTiming.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r120957 r120962  
    2688026880                        </File>
    2688126881                        <File
     26882                                RelativePath="..\page\PerformanceResourceTiming.cpp"
     26883                                >
     26884                        </File>
     26885                        <File
     26886                                RelativePath="..\page\PerformanceResourceTiming.h"
     26887                                >
     26888                        </File>
     26889                        <File
    2688226890                                RelativePath="..\page\PerformanceTiming.cpp"
    2688326891                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r120957 r120962  
    28992899                861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */; };
    29002900                86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */; };
     2901                86512EDE154A2AEF00A90426 /* PerformanceResourceTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86512EDB154A2AEE00A90426 /* PerformanceResourceTiming.cpp */; };
     2902                86512EDF154A2AEF00A90426 /* PerformanceResourceTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86512EDC154A2AEF00A90426 /* PerformanceResourceTiming.h */; };
    29012903                86BE340015058CB200CE0FD8 /* PerformanceEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86BE33FA15058CB200CE0FD8 /* PerformanceEntry.cpp */; };
    29022904                86BE340115058CB200CE0FD8 /* PerformanceEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 86BE33FB15058CB200CE0FD8 /* PerformanceEntry.h */; };
     
    99619963                861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadTiming.cpp; sourceTree = "<group>"; };
    99629964                86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; };
     9965                86512EDB154A2AEE00A90426 /* PerformanceResourceTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceResourceTiming.cpp; sourceTree = "<group>"; };
     9966                86512EDC154A2AEF00A90426 /* PerformanceResourceTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceResourceTiming.h; sourceTree = "<group>"; };
     9967                86512EDD154A2AEF00A90426 /* PerformanceResourceTiming.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PerformanceResourceTiming.idl; sourceTree = "<group>"; };
    99639968                86BE33FA15058CB200CE0FD8 /* PerformanceEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceEntry.cpp; sourceTree = "<group>"; };
    99649969                86BE33FB15058CB200CE0FD8 /* PerformanceEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceEntry.h; sourceTree = "<group>"; };
     
    1562015625                                8AF4E55311DC5A36000ED3DE /* PerformanceNavigation.h */,
    1562115626                                8AF4E55411DC5A36000ED3DE /* PerformanceNavigation.idl */,
     15627                                86512EDB154A2AEE00A90426 /* PerformanceResourceTiming.cpp */,
     15628                                86512EDC154A2AEF00A90426 /* PerformanceResourceTiming.h */,
     15629                                86512EDD154A2AEF00A90426 /* PerformanceResourceTiming.idl */,
    1562215630                                8AF4E55811DC5A63000ED3DE /* PerformanceTiming.cpp */,
    1562315631                                8AF4E55911DC5A63000ED3DE /* PerformanceTiming.h */,
     
    2416224170                                86BE340415058CB200CE0FD8 /* PerformanceEntryList.h in Headers */,
    2416324171                                8AF4E55611DC5A36000ED3DE /* PerformanceNavigation.h in Headers */,
     24172                                86512EDF154A2AEF00A90426 /* PerformanceResourceTiming.h in Headers */,
    2416424173                                8AF4E55C11DC5A63000ED3DE /* PerformanceTiming.h in Headers */,
    2416524174                                49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */,
     
    2739527404                                86BE340315058CB200CE0FD8 /* PerformanceEntryList.cpp in Sources */,
    2739627405                                8AF4E55511DC5A36000ED3DE /* PerformanceNavigation.cpp in Sources */,
     27406                                86512EDE154A2AEF00A90426 /* PerformanceResourceTiming.cpp in Sources */,
    2739727407                                8AF4E55B11DC5A63000ED3DE /* PerformanceTiming.cpp in Sources */,
    2739827408                                49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
  • trunk/Source/WebCore/bindings/v8/custom/V8PerformanceEntryCustom.cpp

    r120960 r120962  
    3030
    3131#include "config.h"
    32 #include "PerformanceEntryList.h"
     32#include "PerformanceEntry.h"
    3333
    34 #if ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE)
     34#if ENABLE(PERFORMANCE_TIMELINE)
    3535
    36 #include "PerformanceEntry.h"
     36#include "Performance.h"
     37#include "PerformanceResourceTiming.h"
     38
     39#include "V8PerformanceEntry.h"
     40#include "V8PerformanceResourceTiming.h"
     41
     42#include <wtf/RefPtr.h>
    3743
    3844namespace WebCore {
    3945
    40 PerformanceEntryList::PerformanceEntryList()
     46v8::Handle<v8::Value> toV8(PerformanceEntry* impl, v8::Isolate* isolate)
    4147{
    42 }
     48    if (!impl)
     49        return v8::Null();
    4350
    44 PerformanceEntryList::~PerformanceEntryList()
    45 {
    46 }
     51#if ENABLE(RESOURCE_TIMING)
     52    if (impl->isResource())
     53        return toV8(static_cast<PerformanceResourceTiming*>(impl), isolate);
     54#endif
    4755
    48 unsigned PerformanceEntryList::length() const
    49 {
    50     return m_entries.size();
    51 }
    52 
    53 PerformanceEntry* PerformanceEntryList::item(unsigned index)
    54 {
    55     if (index < m_entries.size())
    56         return m_entries[index].get();
    57     return 0;
    58 }
    59 
    60 void PerformanceEntryList::append(PassRefPtr<PerformanceEntry> entry)
    61 {
    62     m_entries.append(entry);
     56    return V8PerformanceEntry::wrap(impl);
    6357}
    6458
    6559} // namespace WebCore
    6660
    67 #endif // ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE)
     61#endif // ENABLE(PERFORMANCE_TIMELINE)
  • trunk/Source/WebCore/dom/EventNames.h

    r119763 r120962  
    228228    macro(webkitnetworkinfochange) \
    229229    \
     230    macro(webkitresourcetimingbufferfull) \
     231    \
    230232
    231233// end of DOM_EVENT_NAMES_FOR_EACH
  • trunk/Source/WebCore/dom/EventTargetFactory.in

    r112815 r120962  
    2323Notification conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS
    2424PeerConnection00 conditional=MEDIA_STREAM
     25Performance conditional=WEB_TIMING
    2526SharedWorker conditional=SHARED_WORKERS
    2627SharedWorkerContext conditional=SHARED_WORKERS
  • trunk/Source/WebCore/page/Performance.cpp

    r115503 r120962  
    3535#include "DocumentLoader.h"
    3636#include "MemoryInfo.h"
     37#include "PerformanceEntry.h"
    3738#include "PerformanceNavigation.h"
     39#include "PerformanceResourceTiming.h"
    3840#include "PerformanceTiming.h"
     41#include "ResourceResponse.h"
    3942#include <wtf/CurrentTime.h>
    4043
     
    4851    : DOMWindowProperty(frame)
    4952{
     53}
     54
     55Performance::~Performance()
     56{
     57}
     58
     59const AtomicString& Performance::interfaceName() const
     60{
     61    return eventNames().interfaceForPerformance;
     62}
     63
     64ScriptExecutionContext* Performance::scriptExecutionContext() const
     65{
     66    if (!frame())
     67        return 0;
     68    return frame()->document();
    5069}
    5170
     
    7695{
    7796    RefPtr<PerformanceEntryList> entries = PerformanceEntryList::create();
     97
     98#if ENABLE(RESOURCE_TIMING)
     99    entries->appendAll(m_resourceTimingBuffer);
     100#endif // ENABLE(RESOURCE_TIMING)
     101
    78102    return entries;
    79103}
    80104
    81 PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByType(const String&)
     105PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByType(const String& entryType)
    82106{
    83107    RefPtr<PerformanceEntryList> entries = PerformanceEntryList::create();
     108
     109#if ENABLE(RESOURCE_TIMING)
     110    if (equalIgnoringCase(entryType, "resource"))
     111        for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
     112            entries->append(*resource);
     113#endif // ENABLE(RESOURCE_TIMING)
     114
    84115    return entries;
    85116}
    86117
    87 PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByName(const String&, const String&)
     118PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByName(const String& name, const String& entryType)
    88119{
    89120    RefPtr<PerformanceEntryList> entries = PerformanceEntryList::create();
     121
     122#if ENABLE(RESOURCE_TIMING)
     123    if (entryType.isNull() || equalIgnoringCase(entryType, "resource"))
     124        for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
     125            if ((*resource)->name() == name)
     126                entries->append(*resource);
     127#endif // ENABLE(RESOURCE_TIMING)
     128
    90129    return entries;
    91130}
    92131
    93132#endif // ENABLE(PERFORMANCE_TIMELINE)
     133
     134#if ENABLE(RESOURCE_TIMING)
     135
     136void Performance::webkitClearResourceTimings()
     137{
     138    m_resourceTimingBuffer.clear();
     139}
     140
     141void Performance::webkitSetResourceTimingBufferSize(unsigned int)
     142{
     143    // FIXME: Implement this.
     144}
     145
     146void Performance::addResourceTiming(const ResourceRequest& request, const ResourceResponse& response, double finishTime, Document* requestingDocument)
     147{
     148    if (!response.resourceLoadTiming())
     149        return;
     150
     151    RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(request, response, finishTime, requestingDocument);
     152    // FIXME: Need to enforce buffer limits.
     153    m_resourceTimingBuffer.append(entry);
     154}
     155
     156#endif // ENABLE(RESOURCE_TIMING)
     157
     158EventTargetData* Performance::eventTargetData()
     159{
     160    return &m_eventTargetData;
     161}
     162
     163EventTargetData* Performance::ensureEventTargetData()
     164{
     165    return &m_eventTargetData;
     166}
    94167
    95168double Performance::webkitNow() const
  • trunk/Source/WebCore/page/Performance.h

    r115503 r120962  
    3535
    3636#include "DOMWindowProperty.h"
     37#include "EventTarget.h"
    3738#include "MemoryInfo.h"
    3839#include "PerformanceEntryList.h"
     
    4647namespace WebCore {
    4748
    48 class Performance : public RefCounted<Performance>, public DOMWindowProperty {
     49class Document;
     50class ResourceRequest;
     51class ResourceResponse;
     52
     53class Performance : public RefCounted<Performance>, public DOMWindowProperty, public EventTarget {
    4954public:
    5055    static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); }
     56    ~Performance();
     57
     58    virtual const AtomicString& interfaceName() const;
     59    virtual ScriptExecutionContext* scriptExecutionContext() const;
    5160
    5261    PassRefPtr<MemoryInfo> memory() const;
     
    6170#endif
    6271
     72#if ENABLE(RESOURCE_TIMING)
     73    void webkitClearResourceTimings();
     74    void webkitSetResourceTimingBufferSize(unsigned int);
     75
     76    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
     77
     78    void addResourceTiming(const ResourceRequest&, const ResourceResponse&, double finishTime, Document*);
     79#endif
     80
     81    using RefCounted<Performance>::ref;
     82    using RefCounted<Performance>::deref;
     83
    6384private:
    6485    explicit Performance(Frame*);
    6586
     87    virtual void refEventTarget() { ref(); }
     88    virtual void derefEventTarget() { deref(); }
     89    virtual EventTargetData* eventTargetData();
     90    virtual EventTargetData* ensureEventTargetData();
     91
     92    EventTargetData m_eventTargetData;
     93    ScriptExecutionContext *m_scriptExecutionContext;
     94
    6695    mutable RefPtr<PerformanceNavigation> m_navigation;
    6796    mutable RefPtr<PerformanceTiming> m_timing;
     97
     98#if ENABLE(RESOURCE_TIMING)
     99    Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer;
     100#endif
    68101};
    69102
  • trunk/Source/WebCore/page/Performance.idl

    r115503 r120962  
    3434    interface [
    3535        Conditional=WEB_TIMING,
     36        EventTarget,
    3637        OmitConstructor
    3738    ] Performance {
     
    4546        PerformanceEntryList webkitGetEntriesByName(in DOMString name, in [Optional=DefaultIsNullString] DOMString entryType);
    4647#endif
     48
     49#if defined(ENABLE_RESOURCE_TIMING) && ENABLE_RESOURCE_TIMING
     50        void webkitClearResourceTimings();
     51        void webkitSetResourceTimingBufferSize(in unsigned long maxSize);
     52
     53        attribute EventListener onwebkitresourcetimingbufferfull;
     54#endif
    4755        // See http://www.w3.org/TR/hr-time/ for details.
    4856        double webkitNow();
  • trunk/Source/WebCore/page/PerformanceEntry.cpp

    r115274 r120962  
    4444}
    4545
     46PerformanceEntry::~PerformanceEntry()
     47{
     48}
     49
    4650String PerformanceEntry::name() const
    4751{
  • trunk/Source/WebCore/page/PerformanceEntry.h

    r115274 r120962  
    4343class PerformanceEntry : public RefCounted<PerformanceEntry> {
    4444public:
     45    virtual ~PerformanceEntry();
     46
    4547    String name() const;
    4648    String entryType() const;
    4749    double startTime() const;
    4850    double duration() const;
     51
     52    virtual bool isResource() { return false; }
    4953
    5054protected:
  • trunk/Source/WebCore/page/PerformanceEntry.idl

    r115274 r120962  
    3535        Conditional=WEB_TIMING,
    3636        Conditional=PERFORMANCE_TIMELINE,
     37        CustomToJSObject,
    3738        OmitConstructor
    3839    ] PerformanceEntry {
  • trunk/Source/WebCore/page/PerformanceEntryList.cpp

    r115274 r120962  
    6363}
    6464
     65void PerformanceEntryList::appendAll(const Vector<RefPtr<PerformanceEntry> >& entries)
     66{
     67    m_entries.append(entries);
     68}
     69
    6570} // namespace WebCore
    6671
  • trunk/Source/WebCore/page/PerformanceEntryList.h

    r115274 r120962  
    5252
    5353    void append(PassRefPtr<PerformanceEntry>);
     54    void appendAll(const Vector<RefPtr<PerformanceEntry> >&);
    5455
    5556private:
  • trunk/Source/WebCore/page/PerformanceResourceTiming.h

    r120960 r120962  
    2929 */
    3030
    31 #ifndef PerformanceEntry_h
    32 #define PerformanceEntry_h
     31#ifndef PerformanceResourceTiming_h
     32#define PerformanceResourceTiming_h
    3333
    34 #if ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE)
     34#if ENABLE(RESOURCE_TIMING)
    3535
    36 #include "Performance.h"
     36#include "PerformanceEntry.h"
    3737#include <wtf/PassRefPtr.h>
    38 #include <wtf/RefCounted.h>
     38#include <wtf/RefPtr.h>
    3939#include <wtf/text/WTFString.h>
    4040
    4141namespace WebCore {
    4242
    43 class PerformanceEntry : public RefCounted<PerformanceEntry> {
     43class Document;
     44class KURL;
     45class ResourceLoadTiming;
     46class ResourceRequest;
     47class ResourceResponse;
     48
     49class PerformanceResourceTiming : public PerformanceEntry {
    4450public:
    45     String name() const;
    46     String entryType() const;
    47     double startTime() const;
    48     double duration() const;
     51    static PassRefPtr<PerformanceResourceTiming> create(const ResourceRequest& request, const ResourceResponse& response, double finishTime, Document* requestingDocument)
     52    {
     53        return adoptRef(new PerformanceResourceTiming(request, response, finishTime, requestingDocument));
     54    }
    4955
    50 protected:
    51     PerformanceEntry(const String& name, const String& entryType, double startTime, double duration);
     56    String initiatorType() const;
     57
     58    double redirectStart() const;
     59    double redirectEnd() const;
     60    double fetchStart() const;
     61    double domainLookupStart() const;
     62    double domainLookupEnd() const;
     63    double connectStart() const;
     64    double connectEnd() const;
     65    double secureConnectionStart() const;
     66    double requestStart() const;
     67    double responseStart() const;
     68    double responseEnd() const;
     69
     70    virtual bool isResource() { return true; }
    5271
    5372private:
    54     const String m_name;
    55     const String m_entryType;
    56     const double m_startTime;
    57     const double m_duration;
     73    PerformanceResourceTiming(const ResourceRequest&, const ResourceResponse&, double finishTime, Document*);
     74    ~PerformanceResourceTiming();
     75
     76    double monotonicTimeToDocumentMilliseconds(double seconds) const;
     77    double resourceTimeToDocumentMilliseconds(int deltaMilliseconds) const;
     78
     79    RefPtr<ResourceLoadTiming> m_timing;
     80    double m_finishTime;
     81    RefPtr<Document> m_requestingDocument;
    5882};
    5983
    6084}
    6185
    62 #endif // !ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE)
    63 #endif // !defined(PerformanceEntry_h)
     86#endif // ENABLE(RESOURCE_TIMING)
     87
     88#endif // !defined(PerformanceResourceTiming_h)
  • trunk/Source/WebCore/page/PerformanceResourceTiming.idl

    r120960 r120962  
    3131module window {
    3232
    33     // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html
     33    // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html
    3434    interface [
    35         Conditional=WEB_TIMING,
    36         Conditional=PERFORMANCE_TIMELINE,
     35        Conditional=RESOURCE_TIMING,
    3736        OmitConstructor
    38     ] PerformanceEntry {
    39         readonly attribute DOMString name;
    40         readonly attribute DOMString entryType;
    41         readonly attribute double startTime;
    42         readonly attribute double duration;
     37    ] PerformanceResourceTiming : PerformanceEntry {
     38        readonly attribute DOMString initiatorType;
     39
     40        readonly attribute double redirectStart;
     41        readonly attribute double redirectEnd;
     42        readonly attribute double fetchStart;
     43        readonly attribute double domainLookupStart;
     44        readonly attribute double domainLookupEnd;
     45        readonly attribute double connectStart;
     46        readonly attribute double connectEnd;
     47        readonly attribute double secureConnectionStart;
     48        readonly attribute double requestStart;
     49        readonly attribute double responseStart;
     50        readonly attribute double responseEnd;
    4351    };
    4452}
Note: See TracChangeset for help on using the changeset viewer.