Changeset 102908 in webkit


Ignore:
Timestamp:
Dec 15, 2011 1:59:23 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Unreviewed revert of r102696 ([Navigation Timing] Use monotonicallyIncreasingTime() instead of currentTime()).
Breaks inspector's network panel timeline on chromium.

Source/WebCore:

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Document.cpp:

(WebCore::Document::setReadyState):
(WebCore::Document::finishedParsing):

  • inspector/InspectorInstrumentation.cpp:

(WebCore::InspectorInstrumentation::didFinishLoadingImpl):

  • inspector/InspectorResourceAgent.cpp:

(WebCore::buildObjectForTiming):
(WebCore::buildObjectForResourceResponse):
(WebCore::buildObjectForCachedResource):
(WebCore::InspectorResourceAgent::willSendRequest):
(WebCore::InspectorResourceAgent::didReceiveResponse):
(WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):

  • loader/DocumentLoadTiming.cpp: Removed.
  • loader/DocumentLoadTiming.h:

(WebCore::DocumentLoadTiming::DocumentLoadTiming):

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::stopLoading):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::continueLoadAfterWillSubmitForm):
(WebCore::FrameLoader::loadProvisionalItemFromCachedPage):

  • loader/MainResourceLoader.cpp:

(WebCore::MainResourceLoader::continueAfterNavigationPolicy):
(WebCore::MainResourceLoader::willSendRequest):
(WebCore::MainResourceLoader::didReceiveData):
(WebCore::MainResourceLoader::didFinishLoading):
(WebCore::MainResourceLoader::load):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::dispatchLoadEvent):
(WebCore::DOMWindow::dispatchTimedEvent):

  • page/DOMWindow.h:
  • page/PerformanceNavigation.cpp:

(WebCore::PerformanceNavigation::redirectCount):

  • page/PerformanceTiming.cpp:

(WebCore::getPossiblySkewedTimeInKnownRange):
(WebCore::PerformanceTiming::navigationStart):
(WebCore::PerformanceTiming::unloadEventStart):
(WebCore::PerformanceTiming::unloadEventEnd):
(WebCore::PerformanceTiming::redirectStart):
(WebCore::PerformanceTiming::redirectEnd):
(WebCore::PerformanceTiming::fetchStart):
(WebCore::PerformanceTiming::responseEnd):
(WebCore::PerformanceTiming::domLoading):
(WebCore::PerformanceTiming::domInteractive):
(WebCore::PerformanceTiming::domContentLoadedEventStart):
(WebCore::PerformanceTiming::domContentLoadedEventEnd):
(WebCore::PerformanceTiming::domComplete):
(WebCore::PerformanceTiming::loadEventStart):
(WebCore::PerformanceTiming::loadEventEnd):
(WebCore::PerformanceTiming::resourceLoadTimeRelativeToAbsolute):

  • page/PerformanceTiming.h:
  • platform/network/ResourceLoadTiming.cpp: Removed.
  • platform/network/ResourceLoadTiming.h:

LayoutTests:

  • fast/dom/script-tests/webtiming.js:
Location:
trunk
Files:
2 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102904 r102908  
     12011-12-15  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Unreviewed revert of r102696 ([Navigation Timing] Use monotonicallyIncreasingTime() instead of currentTime()).
     4        Breaks inspector's network panel timeline on chromium.
     5
     6        * fast/dom/script-tests/webtiming.js:
     7
    182011-12-15  Zoltan Herczeg  <zherczeg@webkit.org>
    29
  • trunk/LayoutTests/fast/dom/script-tests/webtiming.js

    r102696 r102908  
    77// Get the order of magnitude correct without a chance for flakiness.
    88var oneHourMilliseconds = 60 * 60 * 1000;
    9 var currentUTC = 0;  // FIXME: Use performance.now() when available.
     9var currentUTC = (new Date()).getTime();
    1010var oneHourAgoUTC = currentUTC - oneHourMilliseconds;
    1111
  • trunk/Source/WebCore/CMakeLists.txt

    r102696 r102908  
    916916    loader/CrossOriginAccessControl.cpp
    917917    loader/CrossOriginPreflightResultCache.cpp
    918     loader/DocumentLoadTiming.cpp
    919918    loader/DocumentLoader.cpp
    920919    loader/DocumentThreadableLoader.cpp
     
    11781177    platform/network/ResourceErrorBase.cpp
    11791178    platform/network/ResourceHandle.cpp
    1180     platform/network/ResourceLoadTiming.cpp
    11811179    platform/network/ResourceRequestBase.cpp
    11821180    platform/network/ResourceResponseBase.cpp
  • trunk/Source/WebCore/ChangeLog

    r102907 r102908  
     12011-12-15  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Unreviewed revert of r102696 ([Navigation Timing] Use monotonicallyIncreasingTime() instead of currentTime()).
     4        Breaks inspector's network panel timeline on chromium.
     5
     6        * CMakeLists.txt:
     7        * GNUmakefile.list.am:
     8        * Target.pri:
     9        * WebCore.gypi:
     10        * WebCore.vcproj/WebCore.vcproj:
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * dom/Document.cpp:
     13        (WebCore::Document::setReadyState):
     14        (WebCore::Document::finishedParsing):
     15        * inspector/InspectorInstrumentation.cpp:
     16        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
     17        * inspector/InspectorResourceAgent.cpp:
     18        (WebCore::buildObjectForTiming):
     19        (WebCore::buildObjectForResourceResponse):
     20        (WebCore::buildObjectForCachedResource):
     21        (WebCore::InspectorResourceAgent::willSendRequest):
     22        (WebCore::InspectorResourceAgent::didReceiveResponse):
     23        (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
     24        * loader/DocumentLoadTiming.cpp: Removed.
     25        * loader/DocumentLoadTiming.h:
     26        (WebCore::DocumentLoadTiming::DocumentLoadTiming):
     27        * loader/FrameLoader.cpp:
     28        (WebCore::FrameLoader::stopLoading):
     29        (WebCore::FrameLoader::commitProvisionalLoad):
     30        (WebCore::FrameLoader::continueLoadAfterWillSubmitForm):
     31        (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
     32        * loader/MainResourceLoader.cpp:
     33        (WebCore::MainResourceLoader::continueAfterNavigationPolicy):
     34        (WebCore::MainResourceLoader::willSendRequest):
     35        (WebCore::MainResourceLoader::didReceiveData):
     36        (WebCore::MainResourceLoader::didFinishLoading):
     37        (WebCore::MainResourceLoader::load):
     38        * page/DOMWindow.cpp:
     39        (WebCore::DOMWindow::dispatchLoadEvent):
     40        (WebCore::DOMWindow::dispatchTimedEvent):
     41        * page/DOMWindow.h:
     42        * page/PerformanceNavigation.cpp:
     43        (WebCore::PerformanceNavigation::redirectCount):
     44        * page/PerformanceTiming.cpp:
     45        (WebCore::getPossiblySkewedTimeInKnownRange):
     46        (WebCore::PerformanceTiming::navigationStart):
     47        (WebCore::PerformanceTiming::unloadEventStart):
     48        (WebCore::PerformanceTiming::unloadEventEnd):
     49        (WebCore::PerformanceTiming::redirectStart):
     50        (WebCore::PerformanceTiming::redirectEnd):
     51        (WebCore::PerformanceTiming::fetchStart):
     52        (WebCore::PerformanceTiming::responseEnd):
     53        (WebCore::PerformanceTiming::domLoading):
     54        (WebCore::PerformanceTiming::domInteractive):
     55        (WebCore::PerformanceTiming::domContentLoadedEventStart):
     56        (WebCore::PerformanceTiming::domContentLoadedEventEnd):
     57        (WebCore::PerformanceTiming::domComplete):
     58        (WebCore::PerformanceTiming::loadEventStart):
     59        (WebCore::PerformanceTiming::loadEventEnd):
     60        (WebCore::PerformanceTiming::resourceLoadTimeRelativeToAbsolute):
     61        * page/PerformanceTiming.h:
     62        * platform/network/ResourceLoadTiming.cpp: Removed.
     63        * platform/network/ResourceLoadTiming.h:
     64
    1652011-12-15  Alexander Pavlov  <apavlov@chromium.org>
    266
  • trunk/Source/WebCore/GNUmakefile.list.am

    r102815 r102908  
    21882188        Source/WebCore/loader/TextTrackLoader.cpp \
    21892189        Source/WebCore/loader/TextTrackLoader.h \
    2190         Source/WebCore/loader/DocumentLoadTiming.cpp \
    2191         Source/WebCore/loader/DocumentLoadTiming.h \
    21922190        Source/WebCore/loader/DocumentLoader.cpp \
    21932191        Source/WebCore/loader/DocumentLoader.h \
     2192        Source/WebCore/loader/DocumentLoadTiming.h \
    21942193        Source/WebCore/loader/DocumentThreadableLoader.cpp \
    21952194        Source/WebCore/loader/DocumentThreadableLoader.h \
     
    28432842        Source/WebCore/platform/network/ResourceLoadInfo.h \
    28442843        Source/WebCore/platform/network/ResourceLoadPriority.h \
    2845         Source/WebCore/platform/network/ResourceLoadTiming.cpp \
    28462844        Source/WebCore/platform/network/ResourceLoadTiming.h \
    28472845        Source/WebCore/platform/network/ResourceRequestBase.cpp \
  • trunk/Source/WebCore/Target.pri

    r102815 r102908  
    915915    loader/CrossOriginPreflightResultCache.cpp \
    916916    loader/cache/CachedResourceLoader.cpp \
    917     loader/DocumentLoadTiming.cpp \
    918917    loader/DocumentLoader.cpp \
    919918    loader/DocumentThreadableLoader.cpp \
     
    11121111    platform/network/ResourceErrorBase.cpp \
    11131112    platform/network/ResourceHandle.cpp \
    1114     platform/network/ResourceLoadTiming.cpp \
    11151113    platform/network/ResourceRequestBase.cpp \
    11161114    platform/network/ResourceResponseBase.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r102838 r102908  
    28212821            'loader/CrossOriginAccessControl.h',
    28222822            'loader/CrossOriginPreflightResultCache.cpp',
    2823             'loader/DocumentLoadTiming.cpp',
    28242823            'loader/DocumentLoader.cpp',
    28252824            'loader/DocumentThreadableLoader.cpp',
     
    42074206            'platform/network/ResourceHandle.cpp',
    42084207            'platform/network/ResourceHandleInternal.h',
    4209             'platform/network/ResourceLoadTiming.cpp',
    42104208            'platform/network/ResourceRequestBase.cpp',
    42114209            'platform/network/ResourceResponseBase.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r102895 r102908  
    2574725747                        </File>
    2574825748                        <File
    25749                                 RelativePath="..\loader\DocumentLoadTiming.cpp"
     25749                                RelativePath="..\loader\DocumentLoader.cpp"
     25750                                >
     25751                        </File>
     25752                        <File
     25753                                RelativePath="..\loader\DocumentLoader.h"
    2575025754                                >
    2575125755                        </File>
    2575225756                        <File
    2575325757                                RelativePath="..\loader\DocumentLoadTiming.h"
    25754                                 >
    25755                         </File>
    25756                         <File
    25757                                 RelativePath="..\loader\DocumentLoader.cpp"
    25758                                 >
    25759                         </File>
    25760                         <File
    25761                                 RelativePath="..\loader\DocumentLoader.h"
    2576225758                                >
    2576325759                        </File>
     
    3021030206                                </File>
    3021130207                                <File
    30212                                         RelativePath="..\platform\network\ResourceLoadTiming.cpp"
    30213                                         >
    30214                                 </File>
    30215                                 <File
    3021630208                                        RelativePath="..\platform\network\ResourceLoadTiming.h"
    3021730209                                        >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r102849 r102908  
    28122812                85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; };
    28132813                85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */; };
    2814                 861C2EA413FB4FDD00062ABB /* DocumentLoadTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */; };
    2815                 861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */; };
    28162814                86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */; };
    28172815                86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D982F6125C154000AD9E3D /* DocumentTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1003510033                85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMKeyboardEvent.h; sourceTree = "<group>"; };
    1003610034                85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMKeyboardEvent.mm; sourceTree = "<group>"; };
    10037                 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentLoadTiming.cpp; sourceTree = "<group>"; };
    10038                 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadTiming.cpp; sourceTree = "<group>"; };
    1003910035                86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; };
    1004010036                86D982F6125C154000AD9E3D /* DocumentTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTiming.h; sourceTree = "<group>"; };
     
    1545715453                                492863981253B8FC00F792D6 /* ResourceLoadInfo.h */,
    1545815454                                E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */,
    15459                                 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */,
    1546015455                                8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */,
    1546115456                                514C76670CE923A1007EF3CD /* ResourceRequestBase.cpp */,
     
    2000920004                                E1C415DD0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp */,
    2001020005                                E1C415D90F655D6F0092D2FB /* CrossOriginPreflightResultCache.h */,
    20011                                 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */,
    20012                                 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */,
    2001320006                                93E227DB0AF589AD00D48324 /* DocumentLoader.cpp */,
    2001420007                                656D371E0ADBA5DE00A4554D /* DocumentLoader.h */,
     20008                                8A12E35C11FA33280025836A /* DocumentLoadTiming.h */,
    2001520009                                0B9056150F2578BE0095FF6A /* DocumentThreadableLoader.cpp */,
    2001620010                                0B9056160F2578BE0095FF6A /* DocumentThreadableLoader.h */,
     
    2212422118                                A8185F4009765766005826D9 /* Document.h in Headers */,
    2212522119                                A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */,
     22120                                656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */,
    2212622121                                8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */,
    22127                                 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */,
    2212822122                                ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */,
    2212922123                                CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */,
     
    2546625460                                A8185F3C09765766005826D9 /* Document.cpp in Sources */,
    2546725461                                A8185F3F09765766005826D9 /* DocumentFragment.cpp in Sources */,
    25468                                 861C2EA413FB4FDD00062ABB /* DocumentLoadTiming.cpp in Sources */,
    2546925462                                93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */,
    2547025463                                1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */,
     
    2708827081                                973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */,
    2708927082                                D0CE58F8125E4CC200F3F199 /* ResourceLoadScheduler.cpp in Sources */,
    27090                                 861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */,
    2709127083                                514C767C0CE923A1007EF3CD /* ResourceRequestBase.cpp in Sources */,
    2709227084                                7EE6846E12D26E3800E79415 /* ResourceRequestCFNet.cpp in Sources */,
  • trunk/Source/WebCore/dom/Document.cpp

    r102877 r102908  
    10481048    case Loading:
    10491049        if (!m_documentTiming.domLoading)
    1050             m_documentTiming.domLoading = monotonicallyIncreasingTime();
     1050            m_documentTiming.domLoading = currentTime();
    10511051        break;
    10521052    case Interactive:
    10531053        if (!m_documentTiming.domInteractive)
    1054             m_documentTiming.domInteractive = monotonicallyIncreasingTime();
     1054            m_documentTiming.domInteractive = currentTime();
    10551055        break;
    10561056    case Complete:
    10571057        if (!m_documentTiming.domComplete)
    1058             m_documentTiming.domComplete = monotonicallyIncreasingTime();
     1058            m_documentTiming.domComplete = currentTime();
    10591059        break;
    10601060    }
     
    42714271    setParsing(false);
    42724272    if (!m_documentTiming.domContentLoadedEventStart)
    4273         m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime();
     4273        m_documentTiming.domContentLoadedEventStart = currentTime();
    42744274    dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false));
    42754275    if (!m_documentTiming.domContentLoadedEventEnd)
    4276         m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();
     4276        m_documentTiming.domContentLoadedEventEnd = currentTime();
    42774277
    42784278    if (RefPtr<Frame> f = frame()) {
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r102903 r102908  
    542542}
    543543
    544 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double monotonicFinishTime)
    545 {
    546     InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
    547     InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent();
    548     if (!timelineAgent && !resourceAgent)
    549         return;
    550 
    551     double finishTime = 0.0;
    552     // FIXME: Expose all of the timing details to inspector and have it calculate finishTime.
    553     if (monotonicFinishTime)
    554         finishTime = loader->timing()->convertMonotonicTimeToDocumentTime(monotonicFinishTime);
    555 
    556     if (timelineAgent)
     544void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
     545{
     546    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    557547        timelineAgent->didFinishLoadingResource(identifier, false, finishTime);
    558     if (resourceAgent)
     548    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    559549        resourceAgent->didFinishLoading(identifier, loader, finishTime);
    560550}
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r102696 r102908  
    104104}
    105105
    106 static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing, DocumentLoader* loader)
     106static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing)
    107107{
    108108    RefPtr<InspectorObject> timingObject = InspectorObject::create();
    109     timingObject->setNumber("requestTime", timing.convertResourceLoadTimeToDocumentTime(loader->timing(), 0));
     109    timingObject->setNumber("requestTime", timing.requestTime);
    110110    timingObject->setNumber("proxyStart", timing.proxyStart);
    111111    timingObject->setNumber("proxyEnd", timing.proxyEnd);
     
    133133}
    134134
    135 static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response, DocumentLoader* loader)
     135static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response)
    136136{
    137137    if (response.isNull())
     
    153153    responseObject->setBoolean("fromDiskCache", response.wasCached());
    154154    if (response.resourceLoadTiming())
    155         responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming(), loader));
     155        responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming()));
    156156
    157157    if (response.resourceLoadInfo()) {
     
    169169}
    170170
    171 static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource, DocumentLoader* loader)
     171static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource)
    172172{
    173173    RefPtr<InspectorObject> resourceObject = InspectorObject::create();
     
    175175    resourceObject->setString("type", InspectorPageAgent::cachedResourceTypeString(cachedResource));
    176176    resourceObject->setNumber("bodySize", cachedResource.encodedSize());
    177     RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(cachedResource.response(), loader);
     177    RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(cachedResource.response());
    178178    if (resourceResponse)
    179179        resourceObject->setObject("response", resourceResponse);
     
    222222        callStackValue = InspectorArray::create();
    223223    RefPtr<InspectorObject> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0);
    224     m_frontend->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), initiatorObject, callStackValue, buildObjectForResourceResponse(redirectResponse, loader));
     224    m_frontend->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), initiatorObject, callStackValue, buildObjectForResourceResponse(redirectResponse));
    225225}
    226226
     
    233233{
    234234    String requestId = IdentifiersFactory::requestId(identifier);
    235     RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response, loader);
     235    RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response);
    236236    InspectorPageAgent::ResourceType type = InspectorPageAgent::OtherResource;
    237237    long cachedResourceSize = 0;
     
    314314    RefPtr<InspectorObject> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0);
    315315
    316     m_frontend->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(*resource, loader));
     316    m_frontend->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(*resource));
    317317}
    318318
  • trunk/Source/WebCore/loader/DocumentLoadTiming.h

    r102696 r102908  
    2727#define DocumentLoadTiming_h
    2828
    29 #include <wtf/CurrentTime.h>
    30 
    3129namespace WebCore {
    3230
    33 class Frame;
    34 class KURL;
     31struct DocumentLoadTiming {
     32    DocumentLoadTiming()
     33        : navigationStart(0.0)
     34        , unloadEventStart(0.0)
     35        , unloadEventEnd(0.0)
     36        , redirectStart(0.0)
     37        , redirectEnd(0.0)
     38        , redirectCount(0)
     39        , fetchStart(0.0)
     40        , responseEnd(0.0)
     41        , loadEventStart(0.0)
     42        , loadEventEnd(0.0)
     43        , hasCrossOriginRedirect(false)
     44        , hasSameOriginAsPreviousDocument(false)
     45    {
     46    }
    3547
    36 class DocumentLoadTiming {
    37 public:
    38     DocumentLoadTiming();
    39 
    40     void markNavigationStart(Frame*);
    41     void addRedirect(const KURL& redirectingUrl, const KURL& redirectedUrl);
    42     double convertMonotonicTimeToDocumentTime(double monotonicTime) const;
    43 
    44     void markUnloadEventStart() { m_unloadEventStart = monotonicallyIncreasingTime(); }
    45     void markUnloadEventEnd() { m_unloadEventEnd = monotonicallyIncreasingTime(); }
    46     void markRedirectStart() { m_redirectStart = monotonicallyIncreasingTime(); }
    47     void markRedirectEnd() { m_redirectEnd = monotonicallyIncreasingTime(); }
    48     void markFetchStart() { m_fetchStart = monotonicallyIncreasingTime(); }
    49     void setResponseEnd(double monotonicTime) { m_responseEnd = monotonicTime; }
    50     void markLoadEventStart() { m_loadEventStart = monotonicallyIncreasingTime(); }
    51     void markLoadEventEnd() { m_loadEventEnd = monotonicallyIncreasingTime(); }
    52 
    53     void setHasSameOriginAsPreviousDocument(bool value) { m_hasSameOriginAsPreviousDocument = value; }
    54 
    55     double navigationStart() const { return convertMonotonicTimeToDocumentTime(m_navigationStart); }
    56     double unloadEventStart() const { return convertMonotonicTimeToDocumentTime(m_unloadEventStart); }
    57     double unloadEventEnd() const { return convertMonotonicTimeToDocumentTime(m_unloadEventEnd); }
    58     double redirectStart() const { return convertMonotonicTimeToDocumentTime(m_redirectStart); }
    59     double redirectEnd() const { return convertMonotonicTimeToDocumentTime(m_redirectEnd); }
    60     short redirectCount() const { return m_redirectCount; }
    61     double fetchStart() const { return convertMonotonicTimeToDocumentTime(m_fetchStart); }
    62     double responseEnd() const { return convertMonotonicTimeToDocumentTime(m_responseEnd); }
    63     double loadEventStart() const { return convertMonotonicTimeToDocumentTime(m_loadEventStart); }
    64     double loadEventEnd() const { return convertMonotonicTimeToDocumentTime(m_loadEventEnd); }
    65     bool hasCrossOriginRedirect() const { return m_hasCrossOriginRedirect; }
    66     bool hasSameOriginAsPreviousDocument() const { return m_hasSameOriginAsPreviousDocument; }
    67 
    68 private:
    69     double m_referenceMonotonicTime;
    70     double m_referenceWallTime;
    71     double m_navigationStart;
    72     double m_unloadEventStart;
    73     double m_unloadEventEnd;
    74     double m_redirectStart;
    75     double m_redirectEnd;
    76     short m_redirectCount;
    77     double m_fetchStart;
    78     double m_responseEnd;
    79     double m_loadEventStart;
    80     double m_loadEventEnd;
    81     bool m_hasCrossOriginRedirect;
    82     bool m_hasSameOriginAsPreviousDocument;
     48    double navigationStart;
     49    double unloadEventStart;
     50    double unloadEventEnd;
     51    double redirectStart;
     52    double redirectEnd;
     53    short redirectCount;
     54    double fetchStart;
     55    double responseEnd;
     56    double loadEventStart;
     57    double loadEventEnd;
     58    bool hasCrossOriginRedirect;
     59    bool hasSameOriginAsPreviousDocument;
    8360};
    8461
    85 } // namespace WebCore
     62}
    8663
    8764#endif
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r102696 r102908  
    377377                        RefPtr<DocumentLoader> documentLoader = m_provisionalDocumentLoader;
    378378                        m_pageDismissalEventBeingDispatched = UnloadDismissal;
    379                         if (documentLoader && !documentLoader->timing()->unloadEventStart() && !documentLoader->timing()->unloadEventEnd()) {
     379                        if (documentLoader && !documentLoader->timing()->unloadEventStart && !documentLoader->timing()->unloadEventEnd) {
    380380                            DocumentLoadTiming* timing = documentLoader->timing();
    381                             ASSERT(timing->navigationStart());
    382                             timing->markUnloadEventStart();
    383                             m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document());
    384                             timing->markUnloadEventEnd();
     381                            ASSERT(timing->navigationStart);
     382                            m_frame->domWindow()->dispatchTimedEvent(unloadEvent, m_frame->domWindow()->document(), &timing->unloadEventStart, &timing->unloadEventEnd);
    385383                        } else
    386384                            m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document());
     
    17741772        // Check if the destination page is allowed to access the previous page's timing information.
    17751773        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url());
    1776         m_documentLoader->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_previousUrl));
     1774        m_documentLoader->timing()->hasSameOriginAsPreviousDocument = securityOrigin->canRequest(m_previousUrl);
    17771775    }
    17781776
     
    23302328    }
    23312329
    2332     m_provisionalDocumentLoader->timing()->markNavigationStart(frame());
     2330    ASSERT(!m_provisionalDocumentLoader->timing()->navigationStart);
     2331    m_provisionalDocumentLoader->timing()->navigationStart = currentTime();
    23332332
    23342333    if (!m_provisionalDocumentLoader->startLoadingMainResource(identifier))
     
    30303029
    30313030    m_loadingFromCachedPage = true;
    3032 
     3031   
    30333032    // Should have timing data from previous time(s) the page was shown.
    3034     ASSERT(provisionalLoader->timing()->navigationStart());
     3033    ASSERT(provisionalLoader->timing()->navigationStart);
    30353034    provisionalLoader->resetTiming();
    3036     provisionalLoader->timing()->markNavigationStart(frame());
     3035    provisionalLoader->timing()->navigationStart = currentTime();   
    30373036
    30383037    provisionalLoader->setCommitted(true);
  • trunk/Source/WebCore/loader/MainResourceLoader.cpp

    r102786 r102908  
    144144    else if (m_substituteData.isValid()) {
    145145        // A redirect resulted in loading substitute data.
    146         ASSERT(documentLoader()->timing()->redirectCount());
     146        ASSERT(documentLoader()->timing()->redirectCount);
    147147        handle()->cancel();
    148148        handleDataLoadSoon(request);
     
    183183    RefPtr<MainResourceLoader> protect(this);
    184184
    185     ASSERT(documentLoader()->timing()->fetchStart());
     185    ASSERT(documentLoader()->timing()->fetchStart);
    186186    if (!redirectResponse.isNull()) {
    187187        // If the redirecting url is not allowed to display content from the target origin,
     
    193193            return;
    194194        }
    195         documentLoader()->timing()->addRedirect(redirectResponse.url(), newRequest.url());
     195
     196        DocumentLoadTiming* documentLoadTiming = documentLoader()->timing();
     197
     198        // Check if the redirected url is allowed to access the redirecting url's timing information.
     199        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(newRequest.url());
     200        if (!securityOrigin->canRequest(redirectResponse.url()))
     201            documentLoadTiming->hasCrossOriginRedirect = true;
     202
     203        documentLoadTiming->redirectCount++;
     204        if (!documentLoadTiming->redirectStart)
     205            documentLoadTiming->redirectStart = documentLoadTiming->fetchStart;
     206        documentLoadTiming->redirectEnd = currentTime();
     207        documentLoadTiming->fetchStart = documentLoadTiming->redirectEnd;
    196208    }
    197209
     
    460472    RefPtr<MainResourceLoader> protect(this);
    461473
    462     m_timeOfLastDataReceived = monotonicallyIncreasingTime();
     474    m_timeOfLastDataReceived = currentTime();
    463475
    464476    ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce);
     
    472484    ASSERT(shouldLoadAsEmptyDocument(frameLoader()->activeDocumentLoader()->url()) || !defersLoading());
    473485#endif
    474 
     486   
    475487    // The additional processing can do anything including possibly removing the last
    476488    // reference to this object.
     
    481493        dl->maybeFinishLoadingMultipartContent();
    482494
    483     documentLoader()->timing()->setResponseEnd(finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : monotonicallyIncreasingTime()));
     495    ASSERT(!documentLoader()->timing()->responseEnd);
     496    documentLoader()->timing()->responseEnd = finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : currentTime());
    484497    frameLoader()->finishedLoading();
    485498    ResourceLoader::didFinishLoading(finishTime);
     
    591604    m_substituteData = substituteData;
    592605
    593     ASSERT(documentLoader()->timing()->navigationStart());
    594     ASSERT(!documentLoader()->timing()->fetchStart());
    595     documentLoader()->timing()->markFetchStart();
     606    ASSERT(documentLoader()->timing()->navigationStart);
     607    ASSERT(!documentLoader()->timing()->fetchStart);
     608    documentLoader()->timing()->fetchStart = currentTime();
    596609    ResourceRequest request(r);
    597610
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r102696 r102908  
    16361636{
    16371637    RefPtr<Event> loadEvent(Event::create(eventNames().loadEvent, false, false));
    1638     if (m_frame && m_frame->loader()->documentLoader() && !m_frame->loader()->documentLoader()->timing()->loadEventStart()) {
     1638    if (m_frame && m_frame->loader()->documentLoader() && !m_frame->loader()->documentLoader()->timing()->loadEventStart) {
    16391639        // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed while dispatching
    16401640        // the event, so protect it to prevent writing the end time into freed memory.
    16411641        RefPtr<DocumentLoader> documentLoader = m_frame->loader()->documentLoader();
    16421642        DocumentLoadTiming* timing = documentLoader->timing();
    1643         timing->markLoadEventStart();
    1644         dispatchEvent(loadEvent, document());
    1645         timing->markLoadEventEnd();
     1643        dispatchTimedEvent(loadEvent, document(), &timing->loadEventStart, &timing->loadEventEnd);
    16461644    } else
    16471645        dispatchEvent(loadEvent, document());
     
    16731671
    16741672    return result;
     1673}
     1674
     1675void DOMWindow::dispatchTimedEvent(PassRefPtr<Event> event, Document* target, double* startTime, double* endTime)
     1676{
     1677    ASSERT(startTime);
     1678    ASSERT(endTime);
     1679    *startTime = currentTime();
     1680    dispatchEvent(event, target);
     1681    *endTime = currentTime();
    16751682}
    16761683
  • trunk/Source/WebCore/page/DOMWindow.h

    r102696 r102908  
    268268        bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget);
    269269        void dispatchLoadEvent();
     270        void dispatchTimedEvent(PassRefPtr<Event> event, Document* target, double* startTime, double* endTime);
    270271
    271272        DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
  • trunk/Source/WebCore/page/PerformanceNavigation.cpp

    r102696 r102908  
    8585
    8686    DocumentLoadTiming* timing = loader->timing();
    87     if (timing->hasCrossOriginRedirect())
     87    if (timing->hasCrossOriginRedirect)
    8888        return 0;
    8989
    90     return timing->redirectCount();
     90    return timing->redirectCount;
    9191}
    9292
  • trunk/Source/WebCore/page/PerformanceTiming.cpp

    r102696 r102908  
    5151}
    5252
     53static double getPossiblySkewedTimeInKnownRange(double skewedTime, double lowerBound, double upperBound)
     54{
     55#if PLATFORM(CHROMIUM)
     56    // The chromium port's currentTime() implementation only syncs with the
     57    // system clock every 60 seconds. So it is possible for timing marks
     58    // collected in different threads or processes to have a small skew.
     59    // FIXME: It may be possible to add a currentTimeFromSystemTime() method
     60    // that eliminates the skew.
     61    if (skewedTime <= lowerBound)
     62        return lowerBound;
     63
     64    if (upperBound <= 0.0)
     65        upperBound = currentTime();
     66
     67    if (skewedTime >= upperBound)
     68        return upperBound;
     69#else
     70    ASSERT_UNUSED(lowerBound, skewedTime >= lowerBound);
     71    ASSERT_UNUSED(upperBound, skewedTime <= upperBound);
     72#endif
     73
     74    return skewedTime;
     75}
     76
    5377PerformanceTiming::PerformanceTiming(Frame* frame)
    5478    : m_frame(frame)
     
    7296        return 0;
    7397
    74     return toIntegerMilliseconds(timing->navigationStart());
     98    return toIntegerMilliseconds(timing->navigationStart);
    7599}
    76100
     
    81105        return 0;
    82106
    83     if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
    84         return 0;
    85 
    86     return toIntegerMilliseconds(timing->unloadEventStart());
     107    if (timing->hasCrossOriginRedirect || !timing->hasSameOriginAsPreviousDocument)
     108        return 0;
     109
     110    return toIntegerMilliseconds(timing->unloadEventStart);
    87111}
    88112
     
    93117        return 0;
    94118
    95     if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
    96         return 0;
    97 
    98     return toIntegerMilliseconds(timing->unloadEventEnd());
     119    if (timing->hasCrossOriginRedirect || !timing->hasSameOriginAsPreviousDocument)
     120        return 0;
     121
     122    return toIntegerMilliseconds(timing->unloadEventEnd);
    99123}
    100124
     
    105129        return 0;
    106130
    107     if (timing->hasCrossOriginRedirect())
    108         return 0;
    109 
    110     return toIntegerMilliseconds(timing->redirectStart());
     131    if (timing->hasCrossOriginRedirect)
     132        return 0;
     133
     134    return toIntegerMilliseconds(timing->redirectStart);
    111135}
    112136
     
    117141        return 0;
    118142
    119     if (timing->hasCrossOriginRedirect())
    120         return 0;
    121 
    122     return toIntegerMilliseconds(timing->redirectEnd());
     143    if (timing->hasCrossOriginRedirect)
     144        return 0;
     145
     146    return toIntegerMilliseconds(timing->redirectEnd);
    123147}
    124148
     
    129153        return 0;
    130154
    131     return toIntegerMilliseconds(timing->fetchStart());
     155    return toIntegerMilliseconds(timing->fetchStart);
    132156}
    133157
     
    254278        return 0;
    255279
    256     return toIntegerMilliseconds(timing->responseEnd());
     280    return toIntegerMilliseconds(timing->responseEnd);
    257281}
    258282
     
    263287        return fetchStart();
    264288
    265     return monotonicTimeToIntegerMilliseconds(timing->domLoading);
     289    return toIntegerMilliseconds(timing->domLoading);
    266290}
    267291
     
    272296        return 0;
    273297
    274     return monotonicTimeToIntegerMilliseconds(timing->domInteractive);
     298    return toIntegerMilliseconds(timing->domInteractive);
    275299}
    276300
     
    281305        return 0;
    282306
    283     return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart);
     307    return toIntegerMilliseconds(timing->domContentLoadedEventStart);
    284308}
    285309
     
    290314        return 0;
    291315
    292     return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd);
     316    return toIntegerMilliseconds(timing->domContentLoadedEventEnd);
    293317}
    294318
     
    299323        return 0;
    300324
    301     return monotonicTimeToIntegerMilliseconds(timing->domComplete);
     325    return toIntegerMilliseconds(timing->domComplete);
    302326}
    303327
     
    308332        return 0;
    309333
    310     return toIntegerMilliseconds(timing->loadEventStart());
     334    return toIntegerMilliseconds(timing->loadEventStart);
    311335}
    312336
     
    317341        return 0;
    318342
    319     return toIntegerMilliseconds(timing->loadEventEnd());
     343    return toIntegerMilliseconds(timing->loadEventEnd);
    320344}
    321345
     
    358382}
    359383
    360 unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relativeMilliseconds) const
    361 {
    362     ASSERT(relativeMilliseconds >= 0);
     384unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relativeSeconds) const
     385{
     386    ASSERT(relativeSeconds >= 0);
    363387    ResourceLoadTiming* resourceTiming = resourceLoadTiming();
    364388    ASSERT(resourceTiming);
    365     return toIntegerMilliseconds(resourceTiming->convertResourceLoadTimeToDocumentTime(documentLoadTiming(), relativeMilliseconds));
    366 }
    367 
    368 unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double monotonicSeconds) const
    369 {
    370     ASSERT(monotonicSeconds >= 0);
    371     const DocumentLoadTiming* timing = documentLoadTiming();
    372     ASSERT(timing);
    373     return toIntegerMilliseconds(timing->convertMonotonicTimeToDocumentTime(monotonicSeconds));
     389    DocumentLoadTiming* documentTiming = documentLoadTiming();
     390    ASSERT(documentTiming);
     391
     392    // The ResourceLoadTiming API's requestTime is the base time to which all
     393    // other marks are relative. So to get an absolute time, we must add it to
     394    // the relative marks.
     395    //
     396    // Since ResourceLoadTimings came from the network platform layer, we must
     397    // check them for skew because they may be from another thread/process.
     398    double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd);
     399    return toIntegerMilliseconds(baseTime) + relativeSeconds;
    374400}
    375401
  • trunk/Source/WebCore/page/PerformanceTiming.h

    r102708 r102908  
    8282    ResourceLoadTiming* resourceLoadTiming() const;
    8383    unsigned long long resourceLoadTimeRelativeToAbsolute(int) const;
    84     unsigned long long monotonicTimeToIntegerMilliseconds(double) const;
    8584
    8685    Frame* m_frame;
  • trunk/Source/WebCore/platform/network/ResourceLoadTiming.h

    r102696 r102908  
    3232
    3333namespace WebCore {
    34 
    35 class DocumentLoadTiming;
    3634
    3735class ResourceLoadTiming : public RefCounted<ResourceLoadTiming> {
     
    8179    }
    8280
    83     // We want to present a unified timeline to Javascript. Using walltime is problematic, because the clock may skew while resources
    84     // load. To prevent that skew, we record a single reference walltime when root document navigation begins. All other times are
    85     // recorded using monotonicallyIncreasingTime(). When a time needs to be presented to Javascript, we build a pseudo-walltime
    86     // using the following equation:
    87     //   pseudo time = document wall reference + (resource request time - document monotonic reference) + deltaMilliseconds / 1000.0.
    88     double convertResourceLoadTimeToDocumentTime(const DocumentLoadTiming* documentTiming, int deltaMilliseconds) const;
    89 
    90     double requestTime; // monotonicallyIncreasingTime() when the port started handling this request.
    91     int proxyStart; // The rest of these are millisecond deltas, using monotonicallyIncreasingTime(), from requestTime.
     81    double requestTime;
     82    int proxyStart;
    9283    int proxyEnd;
    9384    int dnsStart;
Note: See TracChangeset for help on using the changeset viewer.