Changeset 102908 in webkit
- Timestamp:
- Dec 15, 2011 1:59:23 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102904 r102908 1 2011-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 1 8 2011-12-15 Zoltan Herczeg <zherczeg@webkit.org> 2 9 -
trunk/LayoutTests/fast/dom/script-tests/webtiming.js
r102696 r102908 7 7 // Get the order of magnitude correct without a chance for flakiness. 8 8 var oneHourMilliseconds = 60 * 60 * 1000; 9 var currentUTC = 0; // FIXME: Use performance.now() when available.9 var currentUTC = (new Date()).getTime(); 10 10 var oneHourAgoUTC = currentUTC - oneHourMilliseconds; 11 11 -
trunk/Source/WebCore/CMakeLists.txt
r102696 r102908 916 916 loader/CrossOriginAccessControl.cpp 917 917 loader/CrossOriginPreflightResultCache.cpp 918 loader/DocumentLoadTiming.cpp919 918 loader/DocumentLoader.cpp 920 919 loader/DocumentThreadableLoader.cpp … … 1178 1177 platform/network/ResourceErrorBase.cpp 1179 1178 platform/network/ResourceHandle.cpp 1180 platform/network/ResourceLoadTiming.cpp1181 1179 platform/network/ResourceRequestBase.cpp 1182 1180 platform/network/ResourceResponseBase.cpp -
trunk/Source/WebCore/ChangeLog
r102907 r102908 1 2011-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 1 65 2011-12-15 Alexander Pavlov <apavlov@chromium.org> 2 66 -
trunk/Source/WebCore/GNUmakefile.list.am
r102815 r102908 2188 2188 Source/WebCore/loader/TextTrackLoader.cpp \ 2189 2189 Source/WebCore/loader/TextTrackLoader.h \ 2190 Source/WebCore/loader/DocumentLoadTiming.cpp \2191 Source/WebCore/loader/DocumentLoadTiming.h \2192 2190 Source/WebCore/loader/DocumentLoader.cpp \ 2193 2191 Source/WebCore/loader/DocumentLoader.h \ 2192 Source/WebCore/loader/DocumentLoadTiming.h \ 2194 2193 Source/WebCore/loader/DocumentThreadableLoader.cpp \ 2195 2194 Source/WebCore/loader/DocumentThreadableLoader.h \ … … 2843 2842 Source/WebCore/platform/network/ResourceLoadInfo.h \ 2844 2843 Source/WebCore/platform/network/ResourceLoadPriority.h \ 2845 Source/WebCore/platform/network/ResourceLoadTiming.cpp \2846 2844 Source/WebCore/platform/network/ResourceLoadTiming.h \ 2847 2845 Source/WebCore/platform/network/ResourceRequestBase.cpp \ -
trunk/Source/WebCore/Target.pri
r102815 r102908 915 915 loader/CrossOriginPreflightResultCache.cpp \ 916 916 loader/cache/CachedResourceLoader.cpp \ 917 loader/DocumentLoadTiming.cpp \918 917 loader/DocumentLoader.cpp \ 919 918 loader/DocumentThreadableLoader.cpp \ … … 1112 1111 platform/network/ResourceErrorBase.cpp \ 1113 1112 platform/network/ResourceHandle.cpp \ 1114 platform/network/ResourceLoadTiming.cpp \1115 1113 platform/network/ResourceRequestBase.cpp \ 1116 1114 platform/network/ResourceResponseBase.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r102838 r102908 2821 2821 'loader/CrossOriginAccessControl.h', 2822 2822 'loader/CrossOriginPreflightResultCache.cpp', 2823 'loader/DocumentLoadTiming.cpp',2824 2823 'loader/DocumentLoader.cpp', 2825 2824 'loader/DocumentThreadableLoader.cpp', … … 4207 4206 'platform/network/ResourceHandle.cpp', 4208 4207 'platform/network/ResourceHandleInternal.h', 4209 'platform/network/ResourceLoadTiming.cpp',4210 4208 'platform/network/ResourceRequestBase.cpp', 4211 4209 'platform/network/ResourceResponseBase.cpp', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r102895 r102908 25747 25747 </File> 25748 25748 <File 25749 RelativePath="..\loader\DocumentLoadTiming.cpp" 25749 RelativePath="..\loader\DocumentLoader.cpp" 25750 > 25751 </File> 25752 <File 25753 RelativePath="..\loader\DocumentLoader.h" 25750 25754 > 25751 25755 </File> 25752 25756 <File 25753 25757 RelativePath="..\loader\DocumentLoadTiming.h" 25754 >25755 </File>25756 <File25757 RelativePath="..\loader\DocumentLoader.cpp"25758 >25759 </File>25760 <File25761 RelativePath="..\loader\DocumentLoader.h"25762 25758 > 25763 25759 </File> … … 30210 30206 </File> 30211 30207 <File 30212 RelativePath="..\platform\network\ResourceLoadTiming.cpp"30213 >30214 </File>30215 <File30216 30208 RelativePath="..\platform\network\ResourceLoadTiming.h" 30217 30209 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r102849 r102908 2812 2812 85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; }; 2813 2813 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 */; };2816 2814 86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */; }; 2817 2815 86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D982F6125C154000AD9E3D /* DocumentTiming.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10035 10033 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMKeyboardEvent.h; sourceTree = "<group>"; }; 10036 10034 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>"; };10039 10035 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; }; 10040 10036 86D982F6125C154000AD9E3D /* DocumentTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTiming.h; sourceTree = "<group>"; }; … … 15457 15453 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */, 15458 15454 E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */, 15459 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */,15460 15455 8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */, 15461 15456 514C76670CE923A1007EF3CD /* ResourceRequestBase.cpp */, … … 20009 20004 E1C415DD0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp */, 20010 20005 E1C415D90F655D6F0092D2FB /* CrossOriginPreflightResultCache.h */, 20011 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */,20012 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */,20013 20006 93E227DB0AF589AD00D48324 /* DocumentLoader.cpp */, 20014 20007 656D371E0ADBA5DE00A4554D /* DocumentLoader.h */, 20008 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */, 20015 20009 0B9056150F2578BE0095FF6A /* DocumentThreadableLoader.cpp */, 20016 20010 0B9056160F2578BE0095FF6A /* DocumentThreadableLoader.h */, … … 22124 22118 A8185F4009765766005826D9 /* Document.h in Headers */, 22125 22119 A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */, 22120 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */, 22126 22121 8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */, 22127 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */,22128 22122 ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */, 22129 22123 CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */, … … 25466 25460 A8185F3C09765766005826D9 /* Document.cpp in Sources */, 25467 25461 A8185F3F09765766005826D9 /* DocumentFragment.cpp in Sources */, 25468 861C2EA413FB4FDD00062ABB /* DocumentLoadTiming.cpp in Sources */,25469 25462 93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */, 25470 25463 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */, … … 27088 27081 973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */, 27089 27082 D0CE58F8125E4CC200F3F199 /* ResourceLoadScheduler.cpp in Sources */, 27090 861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */,27091 27083 514C767C0CE923A1007EF3CD /* ResourceRequestBase.cpp in Sources */, 27092 27084 7EE6846E12D26E3800E79415 /* ResourceRequestCFNet.cpp in Sources */, -
trunk/Source/WebCore/dom/Document.cpp
r102877 r102908 1048 1048 case Loading: 1049 1049 if (!m_documentTiming.domLoading) 1050 m_documentTiming.domLoading = monotonicallyIncreasingTime();1050 m_documentTiming.domLoading = currentTime(); 1051 1051 break; 1052 1052 case Interactive: 1053 1053 if (!m_documentTiming.domInteractive) 1054 m_documentTiming.domInteractive = monotonicallyIncreasingTime();1054 m_documentTiming.domInteractive = currentTime(); 1055 1055 break; 1056 1056 case Complete: 1057 1057 if (!m_documentTiming.domComplete) 1058 m_documentTiming.domComplete = monotonicallyIncreasingTime();1058 m_documentTiming.domComplete = currentTime(); 1059 1059 break; 1060 1060 } … … 4271 4271 setParsing(false); 4272 4272 if (!m_documentTiming.domContentLoadedEventStart) 4273 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime();4273 m_documentTiming.domContentLoadedEventStart = currentTime(); 4274 4274 dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false)); 4275 4275 if (!m_documentTiming.domContentLoadedEventEnd) 4276 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();4276 m_documentTiming.domContentLoadedEventEnd = currentTime(); 4277 4277 4278 4278 if (RefPtr<Frame> f = frame()) { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r102903 r102908 542 542 } 543 543 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) 544 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime) 545 { 546 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) 557 547 timelineAgent->didFinishLoadingResource(identifier, false, finishTime); 558 if ( resourceAgent)548 if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent()) 559 549 resourceAgent->didFinishLoading(identifier, loader, finishTime); 560 550 } -
trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp
r102696 r102908 104 104 } 105 105 106 static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing , DocumentLoader* loader)106 static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing) 107 107 { 108 108 RefPtr<InspectorObject> timingObject = InspectorObject::create(); 109 timingObject->setNumber("requestTime", timing. convertResourceLoadTimeToDocumentTime(loader->timing(), 0));109 timingObject->setNumber("requestTime", timing.requestTime); 110 110 timingObject->setNumber("proxyStart", timing.proxyStart); 111 111 timingObject->setNumber("proxyEnd", timing.proxyEnd); … … 133 133 } 134 134 135 static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response , DocumentLoader* loader)135 static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response) 136 136 { 137 137 if (response.isNull()) … … 153 153 responseObject->setBoolean("fromDiskCache", response.wasCached()); 154 154 if (response.resourceLoadTiming()) 155 responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming() , loader));155 responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming())); 156 156 157 157 if (response.resourceLoadInfo()) { … … 169 169 } 170 170 171 static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource , DocumentLoader* loader)171 static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource) 172 172 { 173 173 RefPtr<InspectorObject> resourceObject = InspectorObject::create(); … … 175 175 resourceObject->setString("type", InspectorPageAgent::cachedResourceTypeString(cachedResource)); 176 176 resourceObject->setNumber("bodySize", cachedResource.encodedSize()); 177 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(cachedResource.response() , loader);177 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(cachedResource.response()); 178 178 if (resourceResponse) 179 179 resourceObject->setObject("response", resourceResponse); … … 222 222 callStackValue = InspectorArray::create(); 223 223 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)); 225 225 } 226 226 … … 233 233 { 234 234 String requestId = IdentifiersFactory::requestId(identifier); 235 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response , loader);235 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response); 236 236 InspectorPageAgent::ResourceType type = InspectorPageAgent::OtherResource; 237 237 long cachedResourceSize = 0; … … 314 314 RefPtr<InspectorObject> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0); 315 315 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)); 317 317 } 318 318 -
trunk/Source/WebCore/loader/DocumentLoadTiming.h
r102696 r102908 27 27 #define DocumentLoadTiming_h 28 28 29 #include <wtf/CurrentTime.h>30 31 29 namespace WebCore { 32 30 33 class Frame; 34 class KURL; 31 struct 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 } 35 47 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; 83 60 }; 84 61 85 } // namespace WebCore62 } 86 63 87 64 #endif -
trunk/Source/WebCore/loader/FrameLoader.cpp
r102696 r102908 377 377 RefPtr<DocumentLoader> documentLoader = m_provisionalDocumentLoader; 378 378 m_pageDismissalEventBeingDispatched = UnloadDismissal; 379 if (documentLoader && !documentLoader->timing()->unloadEventStart () && !documentLoader->timing()->unloadEventEnd()) {379 if (documentLoader && !documentLoader->timing()->unloadEventStart && !documentLoader->timing()->unloadEventEnd) { 380 380 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); 385 383 } else 386 384 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document()); … … 1774 1772 // Check if the destination page is allowed to access the previous page's timing information. 1775 1773 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); 1777 1775 } 1778 1776 … … 2330 2328 } 2331 2329 2332 m_provisionalDocumentLoader->timing()->markNavigationStart(frame()); 2330 ASSERT(!m_provisionalDocumentLoader->timing()->navigationStart); 2331 m_provisionalDocumentLoader->timing()->navigationStart = currentTime(); 2333 2332 2334 2333 if (!m_provisionalDocumentLoader->startLoadingMainResource(identifier)) … … 3030 3029 3031 3030 m_loadingFromCachedPage = true; 3032 3031 3033 3032 // Should have timing data from previous time(s) the page was shown. 3034 ASSERT(provisionalLoader->timing()->navigationStart ());3033 ASSERT(provisionalLoader->timing()->navigationStart); 3035 3034 provisionalLoader->resetTiming(); 3036 provisionalLoader->timing()-> markNavigationStart(frame());3035 provisionalLoader->timing()->navigationStart = currentTime(); 3037 3036 3038 3037 provisionalLoader->setCommitted(true); -
trunk/Source/WebCore/loader/MainResourceLoader.cpp
r102786 r102908 144 144 else if (m_substituteData.isValid()) { 145 145 // A redirect resulted in loading substitute data. 146 ASSERT(documentLoader()->timing()->redirectCount ());146 ASSERT(documentLoader()->timing()->redirectCount); 147 147 handle()->cancel(); 148 148 handleDataLoadSoon(request); … … 183 183 RefPtr<MainResourceLoader> protect(this); 184 184 185 ASSERT(documentLoader()->timing()->fetchStart ());185 ASSERT(documentLoader()->timing()->fetchStart); 186 186 if (!redirectResponse.isNull()) { 187 187 // If the redirecting url is not allowed to display content from the target origin, … … 193 193 return; 194 194 } 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; 196 208 } 197 209 … … 460 472 RefPtr<MainResourceLoader> protect(this); 461 473 462 m_timeOfLastDataReceived = monotonicallyIncreasingTime();474 m_timeOfLastDataReceived = currentTime(); 463 475 464 476 ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); … … 472 484 ASSERT(shouldLoadAsEmptyDocument(frameLoader()->activeDocumentLoader()->url()) || !defersLoading()); 473 485 #endif 474 486 475 487 // The additional processing can do anything including possibly removing the last 476 488 // reference to this object. … … 481 493 dl->maybeFinishLoadingMultipartContent(); 482 494 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()); 484 497 frameLoader()->finishedLoading(); 485 498 ResourceLoader::didFinishLoading(finishTime); … … 591 604 m_substituteData = substituteData; 592 605 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(); 596 609 ResourceRequest request(r); 597 610 -
trunk/Source/WebCore/page/DOMWindow.cpp
r102696 r102908 1636 1636 { 1637 1637 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) { 1639 1639 // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed while dispatching 1640 1640 // the event, so protect it to prevent writing the end time into freed memory. 1641 1641 RefPtr<DocumentLoader> documentLoader = m_frame->loader()->documentLoader(); 1642 1642 DocumentLoadTiming* timing = documentLoader->timing(); 1643 timing->markLoadEventStart(); 1644 dispatchEvent(loadEvent, document()); 1645 timing->markLoadEventEnd(); 1643 dispatchTimedEvent(loadEvent, document(), &timing->loadEventStart, &timing->loadEventEnd); 1646 1644 } else 1647 1645 dispatchEvent(loadEvent, document()); … … 1673 1671 1674 1672 return result; 1673 } 1674 1675 void 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(); 1675 1682 } 1676 1683 -
trunk/Source/WebCore/page/DOMWindow.h
r102696 r102908 268 268 bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget); 269 269 void dispatchLoadEvent(); 270 void dispatchTimedEvent(PassRefPtr<Event> event, Document* target, double* startTime, double* endTime); 270 271 271 272 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); -
trunk/Source/WebCore/page/PerformanceNavigation.cpp
r102696 r102908 85 85 86 86 DocumentLoadTiming* timing = loader->timing(); 87 if (timing->hasCrossOriginRedirect ())87 if (timing->hasCrossOriginRedirect) 88 88 return 0; 89 89 90 return timing->redirectCount ();90 return timing->redirectCount; 91 91 } 92 92 -
trunk/Source/WebCore/page/PerformanceTiming.cpp
r102696 r102908 51 51 } 52 52 53 static 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 53 77 PerformanceTiming::PerformanceTiming(Frame* frame) 54 78 : m_frame(frame) … … 72 96 return 0; 73 97 74 return toIntegerMilliseconds(timing->navigationStart ());98 return toIntegerMilliseconds(timing->navigationStart); 75 99 } 76 100 … … 81 105 return 0; 82 106 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); 87 111 } 88 112 … … 93 117 return 0; 94 118 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); 99 123 } 100 124 … … 105 129 return 0; 106 130 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); 111 135 } 112 136 … … 117 141 return 0; 118 142 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); 123 147 } 124 148 … … 129 153 return 0; 130 154 131 return toIntegerMilliseconds(timing->fetchStart ());155 return toIntegerMilliseconds(timing->fetchStart); 132 156 } 133 157 … … 254 278 return 0; 255 279 256 return toIntegerMilliseconds(timing->responseEnd ());280 return toIntegerMilliseconds(timing->responseEnd); 257 281 } 258 282 … … 263 287 return fetchStart(); 264 288 265 return monotonicTimeToIntegerMilliseconds(timing->domLoading);289 return toIntegerMilliseconds(timing->domLoading); 266 290 } 267 291 … … 272 296 return 0; 273 297 274 return monotonicTimeToIntegerMilliseconds(timing->domInteractive);298 return toIntegerMilliseconds(timing->domInteractive); 275 299 } 276 300 … … 281 305 return 0; 282 306 283 return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart);307 return toIntegerMilliseconds(timing->domContentLoadedEventStart); 284 308 } 285 309 … … 290 314 return 0; 291 315 292 return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd);316 return toIntegerMilliseconds(timing->domContentLoadedEventEnd); 293 317 } 294 318 … … 299 323 return 0; 300 324 301 return monotonicTimeToIntegerMilliseconds(timing->domComplete);325 return toIntegerMilliseconds(timing->domComplete); 302 326 } 303 327 … … 308 332 return 0; 309 333 310 return toIntegerMilliseconds(timing->loadEventStart ());334 return toIntegerMilliseconds(timing->loadEventStart); 311 335 } 312 336 … … 317 341 return 0; 318 342 319 return toIntegerMilliseconds(timing->loadEventEnd ());343 return toIntegerMilliseconds(timing->loadEventEnd); 320 344 } 321 345 … … 358 382 } 359 383 360 unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relative Milliseconds) const361 { 362 ASSERT(relative Milliseconds >= 0);384 unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relativeSeconds) const 385 { 386 ASSERT(relativeSeconds >= 0); 363 387 ResourceLoadTiming* resourceTiming = resourceLoadTiming(); 364 388 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; 374 400 } 375 401 -
trunk/Source/WebCore/page/PerformanceTiming.h
r102708 r102908 82 82 ResourceLoadTiming* resourceLoadTiming() const; 83 83 unsigned long long resourceLoadTimeRelativeToAbsolute(int) const; 84 unsigned long long monotonicTimeToIntegerMilliseconds(double) const;85 84 86 85 Frame* m_frame; -
trunk/Source/WebCore/platform/network/ResourceLoadTiming.h
r102696 r102908 32 32 33 33 namespace WebCore { 34 35 class DocumentLoadTiming;36 34 37 35 class ResourceLoadTiming : public RefCounted<ResourceLoadTiming> { … … 81 79 } 82 80 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; 92 83 int proxyEnd; 93 84 int dnsStart;
Note: See TracChangeset
for help on using the changeset viewer.