Diff
Modified: trunk/Source/WebCore/ChangeLog (131000 => 131001)
--- trunk/Source/WebCore/ChangeLog 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/ChangeLog 2012-10-11 03:06:24 UTC (rev 131001)
@@ -1,3 +1,50 @@
+2012-10-10 James Simonsen <[email protected]>
+
+ High res times should start at 0
+ https://bugs.webkit.org/show_bug.cgi?id=84912
+
+ Reviewed by Tony Gentilcore.
+
+ Test: Existing Navigation Timing tests.
+
+ * inspector/InspectorInstrumentation.cpp: Use legacy document time, pending 98223.
+ (WebCore):
+ (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
+ * inspector/InspectorResourceAgent.cpp:
+ (WebCore::buildObjectForTiming):
+ * loader/DocumentLoadTiming.cpp:
+ (WebCore::DocumentLoadTiming::convertMonotonicTimeToLegacyDocumentTime):
+ (WebCore):
+ (WebCore::DocumentLoadTiming::convertMonotonicTimeToZeroBasedDocumentTime):
+ (WebCore::DocumentLoadTiming::markNavigationStart):
+ * loader/DocumentLoadTiming.h:
+ (DocumentLoadTiming):
+ (WebCore::DocumentLoadTiming::navigationStart): These just report raw monotonic times now.
+ (WebCore::DocumentLoadTiming::unloadEventStart):
+ (WebCore::DocumentLoadTiming::unloadEventEnd):
+ (WebCore::DocumentLoadTiming::redirectStart):
+ (WebCore::DocumentLoadTiming::redirectEnd):
+ (WebCore::DocumentLoadTiming::fetchStart):
+ (WebCore::DocumentLoadTiming::responseEnd):
+ (WebCore::DocumentLoadTiming::loadEventStart):
+ (WebCore::DocumentLoadTiming::loadEventEnd):
+ * page/PerformanceTiming.cpp:
+ (WebCore::PerformanceTiming::navigationStart): Convert these back to legacy document times.
+ (WebCore::PerformanceTiming::unloadEventStart):
+ (WebCore::PerformanceTiming::unloadEventEnd):
+ (WebCore::PerformanceTiming::redirectStart):
+ (WebCore::PerformanceTiming::redirectEnd):
+ (WebCore::PerformanceTiming::fetchStart):
+ (WebCore::PerformanceTiming::responseEnd):
+ (WebCore::PerformanceTiming::loadEventStart):
+ (WebCore::PerformanceTiming::loadEventEnd):
+ (WebCore::PerformanceTiming::resourceLoadTimeRelativeToAbsolute):
+ (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
+ * platform/network/ResourceLoadTiming.cpp:
+ (WebCore::ResourceLoadTiming::convertResourceLoadTimeToMonotonicTime):
+ * platform/network/ResourceLoadTiming.h:
+ (ResourceLoadTiming):
+
2012-10-10 Levi Weintraub <[email protected]>
Tests failure on Chromium Mac after r130821
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (131000 => 131001)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -746,7 +746,7 @@
double finishTime = 0.0;
// FIXME: Expose all of the timing details to inspector and have it calculate finishTime.
if (monotonicFinishTime)
- finishTime = loader->timing()->convertMonotonicTimeToDocumentTime(monotonicFinishTime);
+ finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFinishTime);
if (timelineAgent)
timelineAgent->didFinishLoadingResource(identifier, false, finishTime, loader->frame());
Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (131000 => 131001)
--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -112,7 +112,7 @@
static PassRefPtr<TypeBuilder::Network::ResourceTiming> buildObjectForTiming(const ResourceLoadTiming& timing, DocumentLoader* loader)
{
return TypeBuilder::Network::ResourceTiming::create()
- .setRequestTime(timing.convertResourceLoadTimeToDocumentTime(loader->timing(), 0))
+ .setRequestTime(loader->timing()->monotonicTimeToPseudoWallTime(timing.convertResourceLoadTimeToMonotonicTime(0)))
.setProxyStart(timing.proxyStart)
.setProxyEnd(timing.proxyEnd)
.setDnsStart(timing.dnsStart)
Modified: trunk/Source/WebCore/loader/DocumentLoadTiming.cpp (131000 => 131001)
--- trunk/Source/WebCore/loader/DocumentLoadTiming.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/loader/DocumentLoadTiming.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -54,22 +54,26 @@
{
}
-void DocumentLoadTiming::markNavigationStart(Frame* frame)
+double DocumentLoadTiming::monotonicTimeToZeroBasedDocumentTime(double monotonicTime) const
{
- ASSERT(frame);
+ if (!monotonicTime)
+ return 0.0;
+ return monotonicTime - m_referenceMonotonicTime;
+}
+
+double DocumentLoadTiming::monotonicTimeToPseudoWallTime(double monotonicTime) const
+{
+ if (!monotonicTime)
+ return 0.0;
+ return m_referenceWallTime + monotonicTime - m_referenceMonotonicTime;
+}
+
+void DocumentLoadTiming::markNavigationStart()
+{
ASSERT(!m_navigationStart && !m_referenceMonotonicTime && !m_referenceWallTime);
- if (frame->page()->mainFrame() == frame) {
- m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime();
- m_referenceWallTime = currentTime();
- } else {
- Document* rootDocument = frame->page()->mainFrame()->document();
- ASSERT(rootDocument);
- DocumentLoadTiming* rootTiming = rootDocument->loader()->timing();
- m_referenceMonotonicTime = rootTiming->m_referenceMonotonicTime;
- m_referenceWallTime = rootTiming->m_referenceWallTime;
- m_navigationStart = monotonicallyIncreasingTime();
- }
+ m_navigationStart = m_referenceMonotonicTime = monotonicallyIncreasingTime();
+ m_referenceWallTime = currentTime();
}
void DocumentLoadTiming::setNavigationStart(double navigationStart)
@@ -89,18 +93,4 @@
m_hasCrossOriginRedirect = !redirectedSecurityOrigin->canRequest(redirectingUrl);
}
-double DocumentLoadTiming::convertMonotonicTimeToDocumentTime(double monotonicTime) const
-{
- if (!monotonicTime)
- return 0.0;
- return m_referenceWallTime + monotonicTime - m_referenceMonotonicTime;
-}
-
-double DocumentLoadTiming::convertMonotonicTimeToZeroBasedDocumentTime(double monotonicTime) const
-{
- if (!monotonicTime)
- return 0.0;
- return monotonicTime - m_referenceMonotonicTime;
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/DocumentLoadTiming.h (131000 => 131001)
--- trunk/Source/WebCore/loader/DocumentLoadTiming.h 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/loader/DocumentLoadTiming.h 2012-10-11 03:06:24 UTC (rev 131001)
@@ -37,16 +37,13 @@
public:
DocumentLoadTiming();
- void markNavigationStart(Frame*);
+ double monotonicTimeToZeroBasedDocumentTime(double) const;
+ double monotonicTimeToPseudoWallTime(double) const;
+
+ void markNavigationStart();
void setNavigationStart(double);
void addRedirect(const KURL& redirectingUrl, const KURL& redirectedUrl);
- double convertMonotonicTimeToDocumentTime(double) const;
- // FIXME: Once convertMonotonicTimeToDocumentTime is zero-based, then this
- // function and convertMonotonicTimeToDocumentTime can be merged. See
- // https://bugs.webkit.org/show_bug.cgi?id=84912 for more details.
- double convertMonotonicTimeToZeroBasedDocumentTime(double) const;
-
void markUnloadEventStart() { m_unloadEventStart = monotonicallyIncreasingTime(); }
void markUnloadEventEnd() { m_unloadEventEnd = monotonicallyIncreasingTime(); }
void markRedirectStart() { m_redirectStart = monotonicallyIncreasingTime(); }
@@ -58,16 +55,16 @@
void setHasSameOriginAsPreviousDocument(bool value) { m_hasSameOriginAsPreviousDocument = value; }
- double navigationStart() const { return convertMonotonicTimeToDocumentTime(m_navigationStart); }
- double unloadEventStart() const { return convertMonotonicTimeToDocumentTime(m_unloadEventStart); }
- double unloadEventEnd() const { return convertMonotonicTimeToDocumentTime(m_unloadEventEnd); }
- double redirectStart() const { return convertMonotonicTimeToDocumentTime(m_redirectStart); }
- double redirectEnd() const { return convertMonotonicTimeToDocumentTime(m_redirectEnd); }
+ double navigationStart() const { return m_navigationStart; }
+ double unloadEventStart() const { return m_unloadEventStart; }
+ double unloadEventEnd() const { return m_unloadEventEnd; }
+ double redirectStart() const { return m_redirectStart; }
+ double redirectEnd() const { return m_redirectEnd; }
short redirectCount() const { return m_redirectCount; }
- double fetchStart() const { return convertMonotonicTimeToDocumentTime(m_fetchStart); }
- double responseEnd() const { return convertMonotonicTimeToDocumentTime(m_responseEnd); }
- double loadEventStart() const { return convertMonotonicTimeToDocumentTime(m_loadEventStart); }
- double loadEventEnd() const { return convertMonotonicTimeToDocumentTime(m_loadEventEnd); }
+ double fetchStart() const { return m_fetchStart; }
+ double responseEnd() const { return m_responseEnd; }
+ double loadEventStart() const { return m_loadEventStart; }
+ double loadEventEnd() const { return m_loadEventEnd; }
bool hasCrossOriginRedirect() const { return m_hasCrossOriginRedirect; }
bool hasSameOriginAsPreviousDocument() const { return m_hasSameOriginAsPreviousDocument; }
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (131000 => 131001)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -842,7 +842,7 @@
void DocumentLoader::startLoadingMainResource()
{
m_mainDocumentError = ResourceError();
- timing()->markNavigationStart(m_frame);
+ timing()->markNavigationStart();
ASSERT(!m_mainResourceLoader);
m_mainResourceLoader = MainResourceLoader::create(m_frame);
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (131000 => 131001)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -2952,7 +2952,7 @@
// Should have timing data from previous time(s) the page was shown.
ASSERT(provisionalLoader->timing()->navigationStart());
provisionalLoader->resetTiming();
- provisionalLoader->timing()->markNavigationStart(frame());
+ provisionalLoader->timing()->markNavigationStart();
provisionalLoader->setCommitted(true);
commitProvisionalLoad();
Modified: trunk/Source/WebCore/page/Performance.cpp (131000 => 131001)
--- trunk/Source/WebCore/page/Performance.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/page/Performance.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -167,7 +167,7 @@
double Performance::webkitNow() const
{
- return 1000.0 * m_frame->document()->loader()->timing()->convertMonotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime());
+ return 1000.0 * m_frame->document()->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/page/PerformanceTiming.cpp (131000 => 131001)
--- trunk/Source/WebCore/page/PerformanceTiming.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/page/PerformanceTiming.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -61,7 +61,7 @@
if (!timing)
return 0;
- return toIntegerMilliseconds(timing->navigationStart());
+ return monotonicTimeToIntegerMilliseconds(timing->navigationStart());
}
unsigned long long PerformanceTiming::unloadEventStart() const
@@ -73,7 +73,7 @@
if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
return 0;
- return toIntegerMilliseconds(timing->unloadEventStart());
+ return monotonicTimeToIntegerMilliseconds(timing->unloadEventStart());
}
unsigned long long PerformanceTiming::unloadEventEnd() const
@@ -85,7 +85,7 @@
if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
return 0;
- return toIntegerMilliseconds(timing->unloadEventEnd());
+ return monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd());
}
unsigned long long PerformanceTiming::redirectStart() const
@@ -97,7 +97,7 @@
if (timing->hasCrossOriginRedirect())
return 0;
- return toIntegerMilliseconds(timing->redirectStart());
+ return monotonicTimeToIntegerMilliseconds(timing->redirectStart());
}
unsigned long long PerformanceTiming::redirectEnd() const
@@ -109,7 +109,7 @@
if (timing->hasCrossOriginRedirect())
return 0;
- return toIntegerMilliseconds(timing->redirectEnd());
+ return monotonicTimeToIntegerMilliseconds(timing->redirectEnd());
}
unsigned long long PerformanceTiming::fetchStart() const
@@ -118,7 +118,7 @@
if (!timing)
return 0;
- return toIntegerMilliseconds(timing->fetchStart());
+ return monotonicTimeToIntegerMilliseconds(timing->fetchStart());
}
unsigned long long PerformanceTiming::domainLookupStart() const
@@ -243,7 +243,7 @@
if (!timing)
return 0;
- return toIntegerMilliseconds(timing->responseEnd());
+ return monotonicTimeToIntegerMilliseconds(timing->responseEnd());
}
unsigned long long PerformanceTiming::domLoading() const
@@ -297,7 +297,7 @@
if (!timing)
return 0;
- return toIntegerMilliseconds(timing->loadEventStart());
+ return monotonicTimeToIntegerMilliseconds(timing->loadEventStart());
}
unsigned long long PerformanceTiming::loadEventEnd() const
@@ -306,7 +306,7 @@
if (!timing)
return 0;
- return toIntegerMilliseconds(timing->loadEventEnd());
+ return monotonicTimeToIntegerMilliseconds(timing->loadEventEnd());
}
DocumentLoader* PerformanceTiming::documentLoader() const
@@ -352,7 +352,7 @@
ASSERT(relativeMilliseconds >= 0);
ResourceLoadTiming* resourceTiming = resourceLoadTiming();
ASSERT(resourceTiming);
- return toIntegerMilliseconds(resourceTiming->convertResourceLoadTimeToDocumentTime(documentLoadTiming(), relativeMilliseconds));
+ return monotonicTimeToIntegerMilliseconds(resourceTiming->convertResourceLoadTimeToMonotonicTime(relativeMilliseconds));
}
unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double monotonicSeconds) const
@@ -360,7 +360,7 @@
ASSERT(monotonicSeconds >= 0);
const DocumentLoadTiming* timing = documentLoadTiming();
ASSERT(timing);
- return toIntegerMilliseconds(timing->convertMonotonicTimeToDocumentTime(monotonicSeconds));
+ return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonicSeconds));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/ResourceLoadTiming.cpp (131000 => 131001)
--- trunk/Source/WebCore/platform/network/ResourceLoadTiming.cpp 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/platform/network/ResourceLoadTiming.cpp 2012-10-11 03:06:24 UTC (rev 131001)
@@ -26,16 +26,11 @@
#include "config.h"
#include "ResourceLoadTiming.h"
-#include "DocumentLoadTiming.h"
-
namespace WebCore {
-double ResourceLoadTiming::convertResourceLoadTimeToDocumentTime(const DocumentLoadTiming* documentTiming, int deltaMilliseconds) const
+double ResourceLoadTiming::convertResourceLoadTimeToMonotonicTime(int deltaMilliseconds) const
{
- if (!documentTiming)
- return 0.0;
-
- return documentTiming->convertMonotonicTimeToDocumentTime(requestTime + deltaMilliseconds / 1000.0);
+ return requestTime + deltaMilliseconds / 1000.0;
}
}
Modified: trunk/Source/WebCore/platform/network/ResourceLoadTiming.h (131000 => 131001)
--- trunk/Source/WebCore/platform/network/ResourceLoadTiming.h 2012-10-11 02:47:06 UTC (rev 131000)
+++ trunk/Source/WebCore/platform/network/ResourceLoadTiming.h 2012-10-11 03:06:24 UTC (rev 131001)
@@ -85,7 +85,7 @@
// recorded using monotonicallyIncreasingTime(). When a time needs to be presented to _javascript_, we build a pseudo-walltime
// using the following equation:
// pseudo time = document wall reference + (resource request time - document monotonic reference) + deltaMilliseconds / 1000.0.
- double convertResourceLoadTimeToDocumentTime(const DocumentLoadTiming* documentTiming, int deltaMilliseconds) const;
+ double convertResourceLoadTimeToMonotonicTime(int deltaMilliseconds) const;
double requestTime; // monotonicallyIncreasingTime() when the port started handling this request.
int proxyStart; // The rest of these are millisecond deltas, using monotonicallyIncreasingTime(), from requestTime.