Changeset 102961 in webkit
- Timestamp:
- Dec 15, 2011 10:45:29 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 21 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102957 r102961 1 2011-12-15 James Simonsen <simonjam@chromium.org> 2 3 [Navigation Timing] Use monotonicallyIncreasingTime() instead of currentTime() 4 https://bugs.webkit.org/show_bug.cgi?id=58354 5 6 Reviewed by Pavel Feldman. 7 8 * fast/dom/script-tests/webtiming.js: Current monotonic time is unknown until performance.now() is available. Use 0 until then. 9 1 10 2011-12-15 Kenneth Russell <kbr@google.com> 2 11 -
trunk/LayoutTests/fast/dom/script-tests/webtiming.js
r102908 r102961 7 7 // Get the order of magnitude correct without a chance for flakiness. 8 8 var oneHourMilliseconds = 60 * 60 * 1000; 9 var currentUTC = (new Date()).getTime();9 var currentUTC = 0; // FIXME: Use performance.now() when available. 10 10 var oneHourAgoUTC = currentUTC - oneHourMilliseconds; 11 11 -
trunk/Source/WebCore/CMakeLists.txt
r102942 r102961 916 916 loader/CrossOriginAccessControl.cpp 917 917 loader/CrossOriginPreflightResultCache.cpp 918 loader/DocumentLoadTiming.cpp 918 919 loader/DocumentLoader.cpp 919 920 loader/DocumentThreadableLoader.cpp … … 1178 1179 platform/network/ResourceErrorBase.cpp 1179 1180 platform/network/ResourceHandle.cpp 1181 platform/network/ResourceLoadTiming.cpp 1180 1182 platform/network/ResourceRequestBase.cpp 1181 1183 platform/network/ResourceResponseBase.cpp -
trunk/Source/WebCore/ChangeLog
r102958 r102961 1 2011-12-15 James Simonsen <simonjam@chromium.org> 2 3 [Navigation Timing] Use monotonicallyIncreasingTime() instead of currentTime() 4 https://bugs.webkit.org/show_bug.cgi?id=58354 5 6 Reviewed by Pavel Feldman. 7 8 No new tests. Relies on existing webtiming-* tests. 9 10 * CMakeLists.txt: 11 * GNUmakefile.list.am: 12 * WebCore.gypi: 13 * WebCore.pro: 14 * WebCore.vcproj/WebCore.vcproj: 15 * WebCore.xcodeproj/project.pbxproj: 16 * dom/Document.cpp: Use monotonic times. 17 (WebCore::Document::setReadyState): 18 (WebCore::Document::finishedParsing): 19 * inspector/InspectorInstrumentation.cpp: 20 (WebCore::InspectorInstrumentation::didFinishLoadingImpl): Convert monotonicFinishTime to wall time if needed. 21 * inspector/InspectorResourceAgent.cpp: 22 (WebCore::buildObjectForTiming): Convert monotonic requestTime to wall time. 23 (WebCore::buildObjectForResourceResponse): Plumbing for above. 24 (WebCore::buildObjectForCachedResource): Ditto. 25 (WebCore::InspectorResourceAgent::willSendRequest): Ditto. 26 (WebCore::InspectorResourceAgent::didReceiveResponse): Ditto. 27 (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): Ditto. 28 * loader/DocumentLoadTiming.cpp: Added. 29 (WebCore::DocumentLoadTiming::DocumentLoadTiming): 30 (WebCore::DocumentLoadTiming::setNavigationStart): Determine reference time and root reference time. 31 (WebCore::DocumentLoadTiming::addRedirect): Moved logic from MainResourceLoader. 32 (WebCore::DocumentLoadTiming::convertMonotonicTimeToDocumentTime): Helper to compute wall time from monotonic time. 33 * loader/DocumentLoadTiming.h: Turned into class. Made times monotonic. 34 (WebCore::DocumentLoadTiming::setUnloadEventStart): 35 (WebCore::DocumentLoadTiming::setUnloadEventEnd): 36 (WebCore::DocumentLoadTiming::setRedirectStart): 37 (WebCore::DocumentLoadTiming::setRedirectEnd): 38 (WebCore::DocumentLoadTiming::setFetchStart): 39 (WebCore::DocumentLoadTiming::setResponseEnd): 40 (WebCore::DocumentLoadTiming::setLoadEventStart): 41 (WebCore::DocumentLoadTiming::setLoadEventEnd): 42 (WebCore::DocumentLoadTiming::setHasSameOriginAsPreviousDocument): 43 (WebCore::DocumentLoadTiming::navigationStart): 44 (WebCore::DocumentLoadTiming::unloadEventStart): 45 (WebCore::DocumentLoadTiming::unloadEventEnd): 46 (WebCore::DocumentLoadTiming::redirectStart): 47 (WebCore::DocumentLoadTiming::redirectEnd): 48 (WebCore::DocumentLoadTiming::redirectCount): 49 (WebCore::DocumentLoadTiming::fetchStart): 50 (WebCore::DocumentLoadTiming::responseEnd): 51 (WebCore::DocumentLoadTiming::loadEventStart): 52 (WebCore::DocumentLoadTiming::loadEventEnd): 53 (WebCore::DocumentLoadTiming::hasCrossOriginRedirect): 54 (WebCore::DocumentLoadTiming::hasSameOriginAsPreviousDocument): 55 * loader/FrameLoader.cpp: 56 (WebCore::FrameLoader::stopLoading): 57 (WebCore::FrameLoader::commitProvisionalLoad): 58 (WebCore::FrameLoader::continueLoadAfterWillSubmitForm): 59 (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): 60 * loader/MainResourceLoader.cpp: 61 (WebCore::MainResourceLoader::continueAfterNavigationPolicy): 62 (WebCore::MainResourceLoader::willSendRequest): Moved logic to DocumentLoadTiming. 63 (WebCore::MainResourceLoader::didReceiveData): Use monotonic time. 64 (WebCore::MainResourceLoader::didFinishLoading): Ditto. 65 (WebCore::MainResourceLoader::load): 66 * page/DOMWindow.cpp: 67 (WebCore::DOMWindow::dispatchLoadEvent): 68 * page/DOMWindow.h: Removed dispatchTimedEvent. It doesn't really help in the new model. 69 * page/PerformanceNavigation.cpp: 70 (WebCore::PerformanceNavigation::redirectCount): 71 * page/PerformanceTiming.cpp: Removed skew correction code. This should never happen now. 72 (WebCore::PerformanceTiming::navigationStart): 73 (WebCore::PerformanceTiming::unloadEventStart): 74 (WebCore::PerformanceTiming::unloadEventEnd): 75 (WebCore::PerformanceTiming::redirectStart): 76 (WebCore::PerformanceTiming::redirectEnd): 77 (WebCore::PerformanceTiming::fetchStart): 78 (WebCore::PerformanceTiming::responseEnd): 79 (WebCore::PerformanceTiming::domLoading): 80 (WebCore::PerformanceTiming::domInteractive): 81 (WebCore::PerformanceTiming::domContentLoadedEventStart): 82 (WebCore::PerformanceTiming::domContentLoadedEventEnd): 83 (WebCore::PerformanceTiming::domComplete): 84 (WebCore::PerformanceTiming::loadEventStart): 85 (WebCore::PerformanceTiming::loadEventEnd): 86 (WebCore::PerformanceTiming::resourceLoadTimeRelativeToAbsolute): Used for ResourceLoadTiming. 87 (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds): Used for DocumentTiming and DocumentLoadTiming. 88 * page/PerformanceTiming.h: 89 * platform/network/ResourceLoadTiming.cpp: 90 (WebCore::ResourceLoadTiming::convertResourceLoadTimeToDocumentTime): 91 * platform/network/ResourceLoadTiming.h: Added helper function to convert to wall times. Added instructions for use. 92 1 93 2011-12-15 Martin Robinson <mrobinson@igalia.com> 2 94 -
trunk/Source/WebCore/GNUmakefile.list.am
r102942 r102961 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 \ 2190 2192 Source/WebCore/loader/DocumentLoader.cpp \ 2191 2193 Source/WebCore/loader/DocumentLoader.h \ 2192 Source/WebCore/loader/DocumentLoadTiming.h \2193 2194 Source/WebCore/loader/DocumentThreadableLoader.cpp \ 2194 2195 Source/WebCore/loader/DocumentThreadableLoader.h \ … … 2846 2847 Source/WebCore/platform/network/ResourceLoadInfo.h \ 2847 2848 Source/WebCore/platform/network/ResourceLoadPriority.h \ 2849 Source/WebCore/platform/network/ResourceLoadTiming.cpp \ 2848 2850 Source/WebCore/platform/network/ResourceLoadTiming.h \ 2849 2851 Source/WebCore/platform/network/ResourceRequestBase.cpp \ -
trunk/Source/WebCore/Target.pri
r102946 r102961 917 917 loader/CrossOriginPreflightResultCache.cpp \ 918 918 loader/cache/CachedResourceLoader.cpp \ 919 loader/DocumentLoadTiming.cpp \ 919 920 loader/DocumentLoader.cpp \ 920 921 loader/DocumentThreadableLoader.cpp \ … … 1113 1114 platform/network/ResourceErrorBase.cpp \ 1114 1115 platform/network/ResourceHandle.cpp \ 1116 platform/network/ResourceLoadTiming.cpp \ 1115 1117 platform/network/ResourceRequestBase.cpp \ 1116 1118 platform/network/ResourceResponseBase.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r102942 r102961 2821 2821 'loader/CrossOriginAccessControl.h', 2822 2822 'loader/CrossOriginPreflightResultCache.cpp', 2823 'loader/DocumentLoadTiming.cpp', 2823 2824 'loader/DocumentLoader.cpp', 2824 2825 'loader/DocumentThreadableLoader.cpp', … … 4210 4211 'platform/network/ResourceHandle.cpp', 4211 4212 'platform/network/ResourceHandleInternal.h', 4213 'platform/network/ResourceLoadTiming.cpp', 4212 4214 'platform/network/ResourceRequestBase.cpp', 4213 4215 'platform/network/ResourceResponseBase.cpp', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r102942 r102961 25747 25747 </File> 25748 25748 <File 25749 RelativePath="..\loader\DocumentLoadTiming.cpp" 25750 > 25751 </File> 25752 <File 25753 RelativePath="..\loader\DocumentLoadTiming.h" 25754 > 25755 </File> 25756 <File 25749 25757 RelativePath="..\loader\DocumentLoader.cpp" 25750 25758 > … … 25752 25760 <File 25753 25761 RelativePath="..\loader\DocumentLoader.h" 25754 >25755 </File>25756 <File25757 RelativePath="..\loader\DocumentLoadTiming.h"25758 25762 > 25759 25763 </File> … … 30222 30226 </File> 30223 30227 <File 30228 RelativePath="..\platform\network\ResourceLoadTiming.cpp" 30229 > 30230 </File> 30231 <File 30224 30232 RelativePath="..\platform\network\ResourceLoadTiming.h" 30225 30233 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r102942 r102961 2818 2818 85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; }; 2819 2819 85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */; }; 2820 861C2EA413FB4FDD00062ABB /* DocumentLoadTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */; }; 2821 861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */; }; 2820 2822 86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */; }; 2821 2823 86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D982F6125C154000AD9E3D /* DocumentTiming.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10045 10047 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMKeyboardEvent.h; sourceTree = "<group>"; }; 10046 10048 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMKeyboardEvent.mm; sourceTree = "<group>"; }; 10049 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentLoadTiming.cpp; sourceTree = "<group>"; }; 10050 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadTiming.cpp; sourceTree = "<group>"; }; 10047 10051 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; }; 10048 10052 86D982F6125C154000AD9E3D /* DocumentTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTiming.h; sourceTree = "<group>"; }; … … 15479 15483 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */, 15480 15484 E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */, 15485 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */, 15481 15486 8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */, 15482 15487 514C76670CE923A1007EF3CD /* ResourceRequestBase.cpp */, … … 20031 20036 E1C415DD0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp */, 20032 20037 E1C415D90F655D6F0092D2FB /* CrossOriginPreflightResultCache.h */, 20038 861C2EA313FB4FDD00062ABB /* DocumentLoadTiming.cpp */, 20039 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */, 20033 20040 93E227DB0AF589AD00D48324 /* DocumentLoader.cpp */, 20034 20041 656D371E0ADBA5DE00A4554D /* DocumentLoader.h */, 20035 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */,20036 20042 0B9056150F2578BE0095FF6A /* DocumentThreadableLoader.cpp */, 20037 20043 0B9056160F2578BE0095FF6A /* DocumentThreadableLoader.h */, … … 22145 22151 A8185F4009765766005826D9 /* Document.h in Headers */, 22146 22152 A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */, 22153 8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */, 22147 22154 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */, 22148 8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */,22149 22155 ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */, 22150 22156 CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */, … … 25490 25496 A8185F3C09765766005826D9 /* Document.cpp in Sources */, 25491 25497 A8185F3F09765766005826D9 /* DocumentFragment.cpp in Sources */, 25498 861C2EA413FB4FDD00062ABB /* DocumentLoadTiming.cpp in Sources */, 25492 25499 93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */, 25493 25500 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */, … … 27111 27118 973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */, 27112 27119 D0CE58F8125E4CC200F3F199 /* ResourceLoadScheduler.cpp in Sources */, 27120 861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */, 27113 27121 514C767C0CE923A1007EF3CD /* ResourceRequestBase.cpp in Sources */, 27114 27122 7EE6846E12D26E3800E79415 /* ResourceRequestCFNet.cpp in Sources */, -
trunk/Source/WebCore/dom/Document.cpp
r102908 r102961 1048 1048 case Loading: 1049 1049 if (!m_documentTiming.domLoading) 1050 m_documentTiming.domLoading = currentTime();1050 m_documentTiming.domLoading = monotonicallyIncreasingTime(); 1051 1051 break; 1052 1052 case Interactive: 1053 1053 if (!m_documentTiming.domInteractive) 1054 m_documentTiming.domInteractive = currentTime();1054 m_documentTiming.domInteractive = monotonicallyIncreasingTime(); 1055 1055 break; 1056 1056 case Complete: 1057 1057 if (!m_documentTiming.domComplete) 1058 m_documentTiming.domComplete = currentTime();1058 m_documentTiming.domComplete = monotonicallyIncreasingTime(); 1059 1059 break; 1060 1060 } … … 4271 4271 setParsing(false); 4272 4272 if (!m_documentTiming.domContentLoadedEventStart) 4273 m_documentTiming.domContentLoadedEventStart = currentTime();4273 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime(); 4274 4274 dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false)); 4275 4275 if (!m_documentTiming.domContentLoadedEventEnd) 4276 m_documentTiming.domContentLoadedEventEnd = currentTime();4276 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime(); 4277 4277 4278 4278 if (RefPtr<Frame> f = frame()) { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r102908 r102961 542 542 } 543 543 544 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime) 545 { 546 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) 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) 547 557 timelineAgent->didFinishLoadingResource(identifier, false, finishTime); 548 if ( InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())558 if (resourceAgent) 549 559 resourceAgent->didFinishLoading(identifier, loader, finishTime); 550 560 } -
trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp
r102908 r102961 104 104 } 105 105 106 static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing )106 static PassRefPtr<InspectorObject> buildObjectForTiming(const ResourceLoadTiming& timing, DocumentLoader* loader) 107 107 { 108 108 RefPtr<InspectorObject> timingObject = InspectorObject::create(); 109 timingObject->setNumber("requestTime", timing. requestTime);109 timingObject->setNumber("requestTime", timing.convertResourceLoadTimeToDocumentTime(loader->timing(), 0)); 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 )135 static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response, DocumentLoader* loader) 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() ));155 responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming(), loader)); 156 156 157 157 if (response.resourceLoadInfo()) { … … 169 169 } 170 170 171 static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource )171 static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource, DocumentLoader* loader) 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() );177 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(cachedResource.response(), loader); 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 ));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)); 225 225 } 226 226 … … 233 233 { 234 234 String requestId = IdentifiersFactory::requestId(identifier); 235 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response );235 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response, loader); 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 ));316 m_frontend->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(*resource, loader)); 317 317 } 318 318 -
trunk/Source/WebCore/loader/DocumentLoadTiming.h
r102908 r102961 27 27 #define DocumentLoadTiming_h 28 28 29 #include <wtf/CurrentTime.h> 30 29 31 namespace WebCore { 30 32 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 } 33 class Frame; 34 class KURL; 47 35 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; 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; 60 83 }; 61 84 62 } 85 } // namespace WebCore 63 86 64 87 #endif -
trunk/Source/WebCore/loader/FrameLoader.cpp
r102908 r102961 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 m_frame->domWindow()->dispatchTimedEvent(unloadEvent, m_frame->domWindow()->document(), &timing->unloadEventStart, &timing->unloadEventEnd); 381 ASSERT(timing->navigationStart()); 382 timing->markUnloadEventStart(); 383 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document()); 384 timing->markUnloadEventEnd(); 383 385 } else 384 386 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document()); … … 1772 1774 // Check if the destination page is allowed to access the previous page's timing information. 1773 1775 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url()); 1774 m_documentLoader->timing()-> hasSameOriginAsPreviousDocument = securityOrigin->canRequest(m_previousUrl);1776 m_documentLoader->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_previousUrl)); 1775 1777 } 1776 1778 … … 2328 2330 } 2329 2331 2330 ASSERT(!m_provisionalDocumentLoader->timing()->navigationStart); 2331 m_provisionalDocumentLoader->timing()->navigationStart = currentTime(); 2332 m_provisionalDocumentLoader->timing()->markNavigationStart(frame()); 2332 2333 2333 2334 if (!m_provisionalDocumentLoader->startLoadingMainResource(identifier)) … … 3029 3030 3030 3031 m_loadingFromCachedPage = true; 3031 3032 3032 3033 // Should have timing data from previous time(s) the page was shown. 3033 ASSERT(provisionalLoader->timing()->navigationStart );3034 ASSERT(provisionalLoader->timing()->navigationStart()); 3034 3035 provisionalLoader->resetTiming(); 3035 provisionalLoader->timing()-> navigationStart = currentTime();3036 provisionalLoader->timing()->markNavigationStart(frame()); 3036 3037 3037 3038 provisionalLoader->setCommitted(true); -
trunk/Source/WebCore/loader/MainResourceLoader.cpp
r102908 r102961 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 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; 195 documentLoader()->timing()->addRedirect(redirectResponse.url(), newRequest.url()); 208 196 } 209 197 … … 472 460 RefPtr<MainResourceLoader> protect(this); 473 461 474 m_timeOfLastDataReceived = currentTime();462 m_timeOfLastDataReceived = monotonicallyIncreasingTime(); 475 463 476 464 ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); … … 484 472 ASSERT(shouldLoadAsEmptyDocument(frameLoader()->activeDocumentLoader()->url()) || !defersLoading()); 485 473 #endif 486 474 487 475 // The additional processing can do anything including possibly removing the last 488 476 // reference to this object. … … 493 481 dl->maybeFinishLoadingMultipartContent(); 494 482 495 ASSERT(!documentLoader()->timing()->responseEnd); 496 documentLoader()->timing()->responseEnd = finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : currentTime()); 483 documentLoader()->timing()->setResponseEnd(finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : monotonicallyIncreasingTime())); 497 484 frameLoader()->finishedLoading(); 498 485 ResourceLoader::didFinishLoading(finishTime); … … 604 591 m_substituteData = substituteData; 605 592 606 ASSERT(documentLoader()->timing()->navigationStart );607 ASSERT(!documentLoader()->timing()->fetchStart );608 documentLoader()->timing()-> fetchStart = currentTime();593 ASSERT(documentLoader()->timing()->navigationStart()); 594 ASSERT(!documentLoader()->timing()->fetchStart()); 595 documentLoader()->timing()->markFetchStart(); 609 596 ResourceRequest request(r); 610 597 -
trunk/Source/WebCore/page/DOMWindow.cpp
r102908 r102961 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 dispatchTimedEvent(loadEvent, document(), &timing->loadEventStart, &timing->loadEventEnd); 1643 timing->markLoadEventStart(); 1644 dispatchEvent(loadEvent, document()); 1645 timing->markLoadEventEnd(); 1644 1646 } else 1645 1647 dispatchEvent(loadEvent, document()); … … 1671 1673 1672 1674 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();1682 1675 } 1683 1676 -
trunk/Source/WebCore/page/DOMWindow.h
r102908 r102961 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);271 270 272 271 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); -
trunk/Source/WebCore/page/PerformanceNavigation.cpp
r102908 r102961 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
r102908 r102961 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 the57 // system clock every 60 seconds. So it is possible for timing marks58 // collected in different threads or processes to have a small skew.59 // FIXME: It may be possible to add a currentTimeFromSystemTime() method60 // 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 #else70 ASSERT_UNUSED(lowerBound, skewedTime >= lowerBound);71 ASSERT_UNUSED(upperBound, skewedTime <= upperBound);72 #endif73 74 return skewedTime;75 }76 77 53 PerformanceTiming::PerformanceTiming(Frame* frame) 78 54 : m_frame(frame) … … 96 72 return 0; 97 73 98 return toIntegerMilliseconds(timing->navigationStart );74 return toIntegerMilliseconds(timing->navigationStart()); 99 75 } 100 76 … … 105 81 return 0; 106 82 107 if (timing->hasCrossOriginRedirect || !timing->hasSameOriginAsPreviousDocument)108 return 0; 109 110 return toIntegerMilliseconds(timing->unloadEventStart );83 if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument()) 84 return 0; 85 86 return toIntegerMilliseconds(timing->unloadEventStart()); 111 87 } 112 88 … … 117 93 return 0; 118 94 119 if (timing->hasCrossOriginRedirect || !timing->hasSameOriginAsPreviousDocument)120 return 0; 121 122 return toIntegerMilliseconds(timing->unloadEventEnd );95 if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument()) 96 return 0; 97 98 return toIntegerMilliseconds(timing->unloadEventEnd()); 123 99 } 124 100 … … 129 105 return 0; 130 106 131 if (timing->hasCrossOriginRedirect )132 return 0; 133 134 return toIntegerMilliseconds(timing->redirectStart );107 if (timing->hasCrossOriginRedirect()) 108 return 0; 109 110 return toIntegerMilliseconds(timing->redirectStart()); 135 111 } 136 112 … … 141 117 return 0; 142 118 143 if (timing->hasCrossOriginRedirect )144 return 0; 145 146 return toIntegerMilliseconds(timing->redirectEnd );119 if (timing->hasCrossOriginRedirect()) 120 return 0; 121 122 return toIntegerMilliseconds(timing->redirectEnd()); 147 123 } 148 124 … … 153 129 return 0; 154 130 155 return toIntegerMilliseconds(timing->fetchStart );131 return toIntegerMilliseconds(timing->fetchStart()); 156 132 } 157 133 … … 278 254 return 0; 279 255 280 return toIntegerMilliseconds(timing->responseEnd );256 return toIntegerMilliseconds(timing->responseEnd()); 281 257 } 282 258 … … 287 263 return fetchStart(); 288 264 289 return toIntegerMilliseconds(timing->domLoading);265 return monotonicTimeToIntegerMilliseconds(timing->domLoading); 290 266 } 291 267 … … 296 272 return 0; 297 273 298 return toIntegerMilliseconds(timing->domInteractive);274 return monotonicTimeToIntegerMilliseconds(timing->domInteractive); 299 275 } 300 276 … … 305 281 return 0; 306 282 307 return toIntegerMilliseconds(timing->domContentLoadedEventStart);283 return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart); 308 284 } 309 285 … … 314 290 return 0; 315 291 316 return toIntegerMilliseconds(timing->domContentLoadedEventEnd);292 return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd); 317 293 } 318 294 … … 323 299 return 0; 324 300 325 return toIntegerMilliseconds(timing->domComplete);301 return monotonicTimeToIntegerMilliseconds(timing->domComplete); 326 302 } 327 303 … … 332 308 return 0; 333 309 334 return toIntegerMilliseconds(timing->loadEventStart );310 return toIntegerMilliseconds(timing->loadEventStart()); 335 311 } 336 312 … … 341 317 return 0; 342 318 343 return toIntegerMilliseconds(timing->loadEventEnd );319 return toIntegerMilliseconds(timing->loadEventEnd()); 344 320 } 345 321 … … 382 358 } 383 359 384 unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relative Seconds) const385 { 386 ASSERT(relative Seconds >= 0);360 unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int relativeMilliseconds) const 361 { 362 ASSERT(relativeMilliseconds >= 0); 387 363 ResourceLoadTiming* resourceTiming = resourceLoadTiming(); 388 364 ASSERT(resourceTiming); 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; 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)); 400 374 } 401 375 -
trunk/Source/WebCore/page/PerformanceTiming.h
r102911 r102961 39 39 namespace WebCore { 40 40 41 structDocumentLoadTiming;41 class DocumentLoadTiming; 42 42 class DocumentLoader; 43 43 struct DocumentTiming; … … 82 82 ResourceLoadTiming* resourceLoadTiming() const; 83 83 unsigned long long resourceLoadTimeRelativeToAbsolute(int) const; 84 unsigned long long monotonicTimeToIntegerMilliseconds(double) const; 84 85 85 86 Frame* m_frame; -
trunk/Source/WebCore/platform/network/ResourceLoadTiming.cpp
r102958 r102961 1 1 /* 2 * Copyright (C) 201 0Google, Inc. All Rights Reserved.2 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 #ifndef DocumentLoadTiming_h 27 #define DocumentLoadTiming_h 26 #include "config.h" 27 #include "ResourceLoadTiming.h" 28 29 #include "DocumentLoadTiming.h" 28 30 29 31 namespace WebCore { 30 32 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 } 33 double ResourceLoadTiming::convertResourceLoadTimeToDocumentTime(const DocumentLoadTiming* documentTiming, int deltaMilliseconds) const 34 { 35 if (!documentTiming) 36 return 0.0; 47 37 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; 60 }; 38 return documentTiming->convertMonotonicTimeToDocumentTime(requestTime + deltaMilliseconds / 1000.0); 39 } 61 40 62 41 } 63 64 #endif -
trunk/Source/WebCore/platform/network/ResourceLoadTiming.h
r102908 r102961 32 32 33 33 namespace WebCore { 34 35 class DocumentLoadTiming; 34 36 35 37 class ResourceLoadTiming : public RefCounted<ResourceLoadTiming> { … … 79 81 } 80 82 81 double requestTime; 82 int proxyStart; 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. 83 92 int proxyEnd; 84 93 int dnsStart;
Note: See TracChangeset
for help on using the changeset viewer.