summaryrefslogtreecommitdiffstats
path: root/WebCore/page/Timing.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-07-30 10:46:49 +0100
committerKristian Monsen <kristianm@google.com>2010-08-04 13:01:34 +0100
commit0617145a89917ae7735fe1c9538688ab9a577df5 (patch)
tree56206078694427c37ed7bdf27eb5221398b833c0 /WebCore/page/Timing.cpp
parentef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff)
downloadexternal_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip
external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz
external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'WebCore/page/Timing.cpp')
-rw-r--r--WebCore/page/Timing.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/WebCore/page/Timing.cpp b/WebCore/page/Timing.cpp
index 527390a..f65322b 100644
--- a/WebCore/page/Timing.cpp
+++ b/WebCore/page/Timing.cpp
@@ -33,6 +33,7 @@
#if ENABLE(WEB_TIMING)
+#include "DocumentLoadTiming.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "ResourceLoadTiming.h"
@@ -159,31 +160,49 @@ unsigned long long Timing::domainLookupEnd() const
unsigned long long Timing::connectStart() const
{
- ResourceLoadTiming* timing = resourceLoadTiming();
+ DocumentLoader* loader = documentLoader();
+ if (!loader)
+ return 0;
+
+ ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
if (!timing)
return 0;
- // This will be -1 when a new connection is not established.
+ // connectStart will be -1 when a network request is not made.
// Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd.
int connectStart = timing->connectStart;
- if (connectStart < 0)
+ if (connectStart < 0 || loader->response().connectionReused())
return domainLookupEnd();
+ // ResourceLoadTiming's connect phase includes DNS and SSL, however Web Timing's
+ // connect phase should not. So if there is DNS time, trim it from the start.
+ if (timing->dnsEnd >= 0 && timing->dnsEnd > connectStart)
+ connectStart = timing->dnsEnd;
+
return resourceLoadTimeRelativeToAbsolute(connectStart);
}
unsigned long long Timing::connectEnd() const
{
- ResourceLoadTiming* timing = resourceLoadTiming();
+ DocumentLoader* loader = documentLoader();
+ if (!loader)
+ return 0;
+
+ ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
if (!timing)
return 0;
- // This will be -1 when a new connection is not established.
+ // connectEnd will be -1 when a network request is not made.
// Rather than exposing a special value that indicates no new connection, we "backfill" with connectStart.
int connectEnd = timing->connectEnd;
- if (connectEnd < 0)
+ if (connectEnd < 0 || loader->response().connectionReused())
return connectStart();
+ // ResourceLoadTiming's connect phase includes DNS and SSL, however Web Timing's
+ // connect phase should not. So if there is SSL time, trim it from the end.
+ if (timing->sslStart >= 0 && timing->sslStart < connectEnd)
+ connectEnd = timing->sslStart;
+
return resourceLoadTimeRelativeToAbsolute(connectEnd);
}
@@ -290,7 +309,7 @@ unsigned long long Timing::resourceLoadTimeRelativeToAbsolute(int relativeSecond
//
// Since ResourceLoadTimings came from the network platform layer, we must
// check them for skew because they may be from another thread/process.
- double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd);
+ double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd - (resourceTiming->receiveHeadersEnd / 1000.0));
return toIntegerMilliseconds(baseTime) + relativeSeconds;
}