<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[211527] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/211527">211527</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-01 14:08:21 -0800 (Wed, 01 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Performance Timeline: Prepare for Worker support
https://bugs.webkit.org/show_bug.cgi?id=167633
Reviewed by Ryosuke Niwa.
Remove references to Document/Frame in Performance. Instead use
ScriptExecutionContext and pass in the time origin / SecurityOrigin
where it is relevant. No tests should change this is just refactoring.
* loader/ResourceTimingInformation.cpp:
(WebCore::ResourceTimingInformation::addResourceTiming):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::performance):
* page/Performance.cpp:
(WebCore::Performance::Performance):
(WebCore::Performance::now):
(WebCore::Performance::reduceTimeResolution):
(WebCore::Performance::navigation):
(WebCore::Performance::timing):
(WebCore::Performance::addResourceTiming):
(WebCore::Performance::scriptExecutionContext): Deleted.
* page/Performance.h:
* page/Performance.idl:
* page/PerformanceResourceTiming.cpp:
(WebCore::monotonicTimeToDOMHighResTimeStamp):
(WebCore::passesTimingAllowCheck):
(WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
(WebCore::PerformanceResourceTiming::redirectStart):
(WebCore::PerformanceResourceTiming::redirectEnd):
(WebCore::PerformanceResourceTiming::fetchStart):
(WebCore::PerformanceResourceTiming::domainLookupStart):
(WebCore::PerformanceResourceTiming::domainLookupEnd):
(WebCore::PerformanceResourceTiming::connectStart):
(WebCore::PerformanceResourceTiming::connectEnd):
(WebCore::PerformanceResourceTiming::secureConnectionStart):
(WebCore::PerformanceResourceTiming::requestStart):
(WebCore::PerformanceResourceTiming::responseStart):
(WebCore::PerformanceResourceTiming::responseEnd):
(WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
(WebCore::monotonicTimeToDocumentMilliseconds): Deleted.
(WebCore::PerformanceResourceTiming::initiatorType): Deleted.
(WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds): Deleted.
* page/PerformanceResourceTiming.h:
* page/PerformanceUserTiming.cpp:
(WebCore::UserTiming::findExistingMarkStartTime):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceTimingInformationcpp">trunk/Source/WebCore/loader/ResourceTimingInformation.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePerformancecpp">trunk/Source/WebCore/page/Performance.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceh">trunk/Source/WebCore/page/Performance.h</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceidl">trunk/Source/WebCore/page/Performance.idl</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceResourceTimingcpp">trunk/Source/WebCore/page/PerformanceResourceTiming.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceResourceTimingh">trunk/Source/WebCore/page/PerformanceResourceTiming.h</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceUserTimingcpp">trunk/Source/WebCore/page/PerformanceUserTiming.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/ChangeLog        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2017-02-01 Joseph Pecoraro <pecoraro@apple.com>
+
+ Performance Timeline: Prepare for Worker support
+ https://bugs.webkit.org/show_bug.cgi?id=167633
+
+ Reviewed by Ryosuke Niwa.
+
+ Remove references to Document/Frame in Performance. Instead use
+ ScriptExecutionContext and pass in the time origin / SecurityOrigin
+ where it is relevant. No tests should change this is just refactoring.
+
+ * loader/ResourceTimingInformation.cpp:
+ (WebCore::ResourceTimingInformation::addResourceTiming):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::performance):
+ * page/Performance.cpp:
+ (WebCore::Performance::Performance):
+ (WebCore::Performance::now):
+ (WebCore::Performance::reduceTimeResolution):
+ (WebCore::Performance::navigation):
+ (WebCore::Performance::timing):
+ (WebCore::Performance::addResourceTiming):
+ (WebCore::Performance::scriptExecutionContext): Deleted.
+ * page/Performance.h:
+ * page/Performance.idl:
+ * page/PerformanceResourceTiming.cpp:
+ (WebCore::monotonicTimeToDOMHighResTimeStamp):
+ (WebCore::passesTimingAllowCheck):
+ (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
+ (WebCore::PerformanceResourceTiming::redirectStart):
+ (WebCore::PerformanceResourceTiming::redirectEnd):
+ (WebCore::PerformanceResourceTiming::fetchStart):
+ (WebCore::PerformanceResourceTiming::domainLookupStart):
+ (WebCore::PerformanceResourceTiming::domainLookupEnd):
+ (WebCore::PerformanceResourceTiming::connectStart):
+ (WebCore::PerformanceResourceTiming::connectEnd):
+ (WebCore::PerformanceResourceTiming::secureConnectionStart):
+ (WebCore::PerformanceResourceTiming::requestStart):
+ (WebCore::PerformanceResourceTiming::responseStart):
+ (WebCore::PerformanceResourceTiming::responseEnd):
+ (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
+ (WebCore::monotonicTimeToDocumentMilliseconds): Deleted.
+ (WebCore::PerformanceResourceTiming::initiatorType): Deleted.
+ (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds): Deleted.
+ * page/PerformanceResourceTiming.h:
+ * page/PerformanceUserTiming.cpp:
+ (WebCore::UserTiming::findExistingMarkStartTime):
+
</ins><span class="cx"> 2017-02-01 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceTimingInformationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.cpp (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceTimingInformation.cpp        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.cpp        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> ASSERT(initiatorDocument->domWindow());
</span><span class="cx"> ASSERT(initiatorDocument->domWindow()->performance());
</span><span class="cx"> const InitiatorInfo& info = initiatorIt->value;
</span><del>- initiatorDocument->domWindow()->performance()->addResourceTiming(info.name, initiatorDocument, resource->resourceRequest().url(), resource->response(), loadTiming);
</del><ins>+ initiatorDocument->domWindow()->performance()->addResourceTiming(info.name, resource->resourceRequest().url(), resource->response(), loadTiming);
</ins><span class="cx"> initiatorIt->value.added = Added;
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -799,8 +799,10 @@
</span><span class="cx"> {
</span><span class="cx"> if (!isCurrentlyDisplayedInFrame())
</span><span class="cx"> return nullptr;
</span><del>- if (!m_performance)
- m_performance = Performance::create(*m_frame);
</del><ins>+ if (!m_performance) {
+ double timeOrigin = document()->loader() ? document()->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime();
+ m_performance = Performance::create(*document(), timeOrigin);
+ }
</ins><span class="cx"> return m_performance.get();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformancecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Performance.cpp (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Performance.cpp        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/Performance.cpp        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -46,15 +46,16 @@
</span><span class="cx"> #include "PerformanceTiming.h"
</span><span class="cx"> #include "PerformanceUserTiming.h"
</span><span class="cx"> #include "ResourceResponse.h"
</span><ins>+#include "ScriptExecutionContext.h"
</ins><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-Performance::Performance(Frame& frame)
- : DOMWindowProperty(&frame)
- , m_referenceTime(frame.document()->loader() ? frame.document()->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime())
</del><ins>+Performance::Performance(ScriptExecutionContext& context, double timeOrigin)
+ : ContextDestructionObserver(&context)
+ , m_timeOrigin(timeOrigin)
</ins><span class="cx"> {
</span><del>- ASSERT(m_referenceTime);
</del><ins>+ ASSERT(m_timeOrigin);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Performance::~Performance()
</span><span class="lines">@@ -61,25 +62,38 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ScriptExecutionContext* Performance::scriptExecutionContext() const
</del><ins>+double Performance::now() const
</ins><span class="cx"> {
</span><del>- if (!frame())
- return nullptr;
- return frame()->document();
</del><ins>+ double nowSeconds = monotonicallyIncreasingTime() - m_timeOrigin;
+ return 1000.0 * reduceTimeResolution(nowSeconds);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-PerformanceNavigation& Performance::navigation()
</del><ins>+double Performance::reduceTimeResolution(double seconds)
</ins><span class="cx"> {
</span><ins>+ const double resolutionSeconds = 0.0001;
+ return std::floor(seconds / resolutionSeconds) * resolutionSeconds;
+}
+
+PerformanceNavigation* Performance::navigation()
+{
+ if (!is<Document>(scriptExecutionContext()))
+ return nullptr;
+
+ ASSERT(isMainThread());
</ins><span class="cx"> if (!m_navigation)
</span><del>- m_navigation = PerformanceNavigation::create(m_frame);
- return *m_navigation;
</del><ins>+ m_navigation = PerformanceNavigation::create(downcast<Document>(*scriptExecutionContext()).frame());
+ return m_navigation.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-PerformanceTiming& Performance::timing()
</del><ins>+PerformanceTiming* Performance::timing()
</ins><span class="cx"> {
</span><ins>+ if (!is<Document>(scriptExecutionContext()))
+ return nullptr;
+
+ ASSERT(isMainThread());
</ins><span class="cx"> if (!m_timing)
</span><del>- m_timing = PerformanceTiming::create(m_frame);
- return *m_timing;
</del><ins>+ m_timing = PerformanceTiming::create(downcast<Document>(*scriptExecutionContext()).frame());
+ return m_timing.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<RefPtr<PerformanceEntry>> Performance::getEntries() const
</span><span class="lines">@@ -150,13 +164,17 @@
</span><span class="cx"> dispatchEvent(Event::create(eventNames().resourcetimingbufferfullEvent, false, false));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Performance::addResourceTiming(const String& initiatorName, Document* initiatorDocument, const URL& originalURL, const ResourceResponse& response, const LoadTiming& loadTiming)
</del><ins>+void Performance::addResourceTiming(const String& initiatorName, const URL& originalURL, const ResourceResponse& response, const LoadTiming& loadTiming)
</ins><span class="cx"> {
</span><span class="cx"> if (isResourceTimingBufferFull())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(initiatorName, originalURL, response, loadTiming, initiatorDocument);
</del><ins>+ SecurityOrigin* securityOrigin = scriptExecutionContext()->securityOrigin();
+ if (!securityOrigin)
+ return;
</ins><span class="cx">
</span><ins>+ RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(initiatorName, originalURL, response, *securityOrigin, m_timeOrigin, loadTiming);
+
</ins><span class="cx"> m_resourceTimingBuffer.append(entry);
</span><span class="cx">
</span><span class="cx"> if (isResourceTimingBufferFull())
</span><span class="lines">@@ -220,18 +238,6 @@
</span><span class="cx"> m_observers.remove(&observer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-double Performance::now() const
-{
- double nowSeconds = monotonicallyIncreasingTime() - m_referenceTime;
- return 1000.0 * reduceTimeResolution(nowSeconds);
-}
-
-double Performance::reduceTimeResolution(double seconds)
-{
- const double resolutionSeconds = 0.0001;
- return std::floor(seconds / resolutionSeconds) * resolutionSeconds;
-}
-
</del><span class="cx"> void Performance::queueEntry(PerformanceEntry& entry)
</span><span class="cx"> {
</span><span class="cx"> bool shouldScheduleTask = false;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Performance.h (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Performance.h        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/Performance.h        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><span class="cx">
</span><del>-#include "DOMWindowProperty.h"
</del><ins>+#include "ContextDestructionObserver.h"
</ins><span class="cx"> #include "EventTarget.h"
</span><span class="cx"> #include "ExceptionOr.h"
</span><span class="cx"> #include "GenericTaskQueue.h"
</span><span class="lines">@@ -42,7 +42,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class Document;
</del><span class="cx"> class LoadTiming;
</span><span class="cx"> class PerformanceEntry;
</span><span class="cx"> class PerformanceNavigation;
</span><span class="lines">@@ -49,18 +48,20 @@
</span><span class="cx"> class PerformanceObserver;
</span><span class="cx"> class PerformanceTiming;
</span><span class="cx"> class ResourceResponse;
</span><ins>+class ScriptExecutionContext;
</ins><span class="cx"> class URL;
</span><span class="cx"> class UserTiming;
</span><span class="cx">
</span><del>-class Performance final : public RefCounted<Performance>, public DOMWindowProperty, public EventTargetWithInlineData {
</del><ins>+class Performance final : public RefCounted<Performance>, public ContextDestructionObserver, public EventTargetWithInlineData {
</ins><span class="cx"> public:
</span><del>- static Ref<Performance> create(Frame& frame) { return adoptRef(*new Performance(frame)); }
</del><ins>+ static Ref<Performance> create(ScriptExecutionContext& context, double timeOrigin) { return adoptRef(*new Performance(context, timeOrigin)); }
</ins><span class="cx"> ~Performance();
</span><span class="cx">
</span><del>- PerformanceNavigation& navigation();
- PerformanceTiming& timing();
</del><span class="cx"> double now() const;
</span><span class="cx">
</span><ins>+ PerformanceNavigation* navigation();
+ PerformanceTiming* timing();
+
</ins><span class="cx"> Vector<RefPtr<PerformanceEntry>> getEntries() const;
</span><span class="cx"> Vector<RefPtr<PerformanceEntry>> getEntriesByType(const String& entryType) const;
</span><span class="cx"> Vector<RefPtr<PerformanceEntry>> getEntriesByName(const String& name, const String& entryType) const;
</span><span class="lines">@@ -68,7 +69,7 @@
</span><span class="cx"> void clearResourceTimings();
</span><span class="cx"> void setResourceTimingBufferSize(unsigned);
</span><span class="cx">
</span><del>- void addResourceTiming(const String& initiatorName, Document*, const URL& originalURL, const ResourceResponse&, const LoadTiming&);
</del><ins>+ void addResourceTiming(const String& initiatorName, const URL& originalURL, const ResourceResponse&, const LoadTiming&);
</ins><span class="cx">
</span><span class="cx"> ExceptionOr<void> mark(const String& markName);
</span><span class="cx"> void clearMarks(const String& markName);
</span><span class="lines">@@ -81,14 +82,15 @@
</span><span class="cx">
</span><span class="cx"> static double reduceTimeResolution(double seconds);
</span><span class="cx">
</span><ins>+ ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
+
</ins><span class="cx"> using RefCounted::ref;
</span><span class="cx"> using RefCounted::deref;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- explicit Performance(Frame&);
</del><ins>+ Performance(ScriptExecutionContext&, double timeOrigin);
</ins><span class="cx">
</span><span class="cx"> EventTargetInterface eventTargetInterface() const final { return PerformanceEventTargetInterfaceType; }
</span><del>- ScriptExecutionContext* scriptExecutionContext() const final;
</del><span class="cx">
</span><span class="cx"> void refEventTarget() final { ref(); }
</span><span class="cx"> void derefEventTarget() final { deref(); }
</span><span class="lines">@@ -104,7 +106,7 @@
</span><span class="cx"> Vector<RefPtr<PerformanceEntry>> m_resourceTimingBuffer;
</span><span class="cx"> unsigned m_resourceTimingBufferSize { 150 };
</span><span class="cx">
</span><del>- double m_referenceTime;
</del><ins>+ double m_timeOrigin;
</ins><span class="cx">
</span><span class="cx"> std::unique_ptr<UserTiming> m_userTiming;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Performance.idl (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Performance.idl        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/Performance.idl        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx">
</span><span class="cx"> [
</span><span class="cx"> Conditional=WEB_TIMING,
</span><del>- GenerateIsReachable=ImplFrame,
</del><ins>+ GenerateIsReachable=ImplScriptExecutionContext,
</ins><span class="cx"> ] interface Performance : EventTarget {
</span><span class="cx">
</span><span class="cx"> DOMHighResTimeStamp now();
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceResourceTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.cpp (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceResourceTiming.cpp        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.cpp        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -45,16 +45,18 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static double monotonicTimeToDocumentMilliseconds(Document* document, double seconds)
</del><ins>+static double monotonicTimeToDOMHighResTimeStamp(double timeOrigin, double seconds)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(seconds >= 0.0);
</span><del>- return Performance::reduceTimeResolution(document->loader()->timing().monotonicTimeToZeroBasedDocumentTime(seconds)) * 1000.0;
</del><ins>+ if (!seconds || !timeOrigin)
+ return 0;
+ return Performance::reduceTimeResolution(seconds - timeOrigin) * 1000.0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static bool passesTimingAllowCheck(const ResourceResponse& response, Document* requestingDocument)
</del><ins>+static bool passesTimingAllowCheck(const ResourceResponse& response, const SecurityOrigin& initiatorSecurityOrigin)
</ins><span class="cx"> {
</span><span class="cx"> Ref<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url());
</span><del>- if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin()))
</del><ins>+ if (resourceOrigin->isSameSchemeHostPort(initiatorSecurityOrigin))
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> const String& timingAllowOriginString = response.httpHeaderField(HTTPHeaderName::TimingAllowOrigin);
</span><span class="lines">@@ -64,7 +66,7 @@
</span><span class="cx"> if (timingAllowOriginString == "*")
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- const String& securityOrigin = requestingDocument->securityOrigin().toString();
</del><ins>+ const String& securityOrigin = initiatorSecurityOrigin.toString();
</ins><span class="cx"> Vector<String> timingAllowOrigins;
</span><span class="cx"> timingAllowOriginString.split(' ', timingAllowOrigins);
</span><span class="cx"> for (auto& origin : timingAllowOrigins) {
</span><span class="lines">@@ -75,13 +77,13 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PerformanceResourceTiming::PerformanceResourceTiming(const AtomicString& initiatorType, const URL& originalURL, const ResourceResponse& response, LoadTiming loadTiming, Document* requestingDocument)
- : PerformanceEntry(PerformanceEntry::Type::Resource, originalURL.string(), ASCIILiteral("resource"), monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.startTime()), monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.responseEnd()))
</del><ins>+PerformanceResourceTiming::PerformanceResourceTiming(const AtomicString& initiatorType, const URL& originalURL, const ResourceResponse& response, const SecurityOrigin& initiatorSecurityOrigin, double timeOrigin, LoadTiming loadTiming)
+ : PerformanceEntry(PerformanceEntry::Type::Resource, originalURL.string(), ASCIILiteral("resource"), monotonicTimeToDOMHighResTimeStamp(timeOrigin, loadTiming.startTime()), monotonicTimeToDOMHighResTimeStamp(timeOrigin, loadTiming.responseEnd()))
</ins><span class="cx"> , m_initiatorType(initiatorType)
</span><span class="cx"> , m_timing(response.networkLoadTiming())
</span><span class="cx"> , m_loadTiming(loadTiming)
</span><del>- , m_shouldReportDetails(passesTimingAllowCheck(response, requestingDocument))
- , m_requestingDocument(requestingDocument)
</del><ins>+ , m_shouldReportDetails(passesTimingAllowCheck(response, initiatorSecurityOrigin))
+ , m_timeOrigin(timeOrigin)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -89,11 +91,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-AtomicString PerformanceResourceTiming::initiatorType() const
-{
- return m_initiatorType;
-}
-
</del><span class="cx"> double PerformanceResourceTiming::workerStart() const
</span><span class="cx"> {
</span><span class="cx"> return 0.0;
</span><span class="lines">@@ -104,7 +101,7 @@
</span><span class="cx"> if (!m_shouldReportDetails)
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.redirectStart());
</del><ins>+ return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadTiming.redirectStart());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::redirectEnd() const
</span><span class="lines">@@ -112,12 +109,12 @@
</span><span class="cx"> if (!m_shouldReportDetails)
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.redirectEnd());
</del><ins>+ return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadTiming.redirectEnd());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::fetchStart() const
</span><span class="cx"> {
</span><del>- return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.fetchStart());
</del><ins>+ return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadTiming.fetchStart());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::domainLookupStart() const
</span><span class="lines">@@ -128,7 +125,7 @@
</span><span class="cx"> if (m_timing.domainLookupStart <= 0)
</span><span class="cx"> return fetchStart();
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(m_timing.domainLookupStart);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(m_timing.domainLookupStart);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::domainLookupEnd() const
</span><span class="lines">@@ -139,7 +136,7 @@
</span><span class="cx"> if (m_timing.domainLookupEnd <= 0)
</span><span class="cx"> return domainLookupStart();
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(m_timing.domainLookupEnd);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(m_timing.domainLookupEnd);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::connectStart() const
</span><span class="lines">@@ -156,7 +153,7 @@
</span><span class="cx"> if (m_timing.domainLookupEnd >= 0)
</span><span class="cx"> connectStart = m_timing.domainLookupEnd;
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(connectStart);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(connectStart);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::connectEnd() const
</span><span class="lines">@@ -168,7 +165,7 @@
</span><span class="cx"> if (m_timing.connectEnd <= 0)
</span><span class="cx"> return connectStart();
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(m_timing.connectEnd);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(m_timing.connectEnd);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::secureConnectionStart() const
</span><span class="lines">@@ -179,7 +176,7 @@
</span><span class="cx"> if (m_timing.secureConnectionStart < 0) // Secure connection not negotiated.
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(m_timing.secureConnectionStart);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(m_timing.secureConnectionStart);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::requestStart() const
</span><span class="lines">@@ -187,7 +184,7 @@
</span><span class="cx"> if (!m_shouldReportDetails)
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(m_timing.requestStart);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(m_timing.requestStart);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::responseStart() const
</span><span class="lines">@@ -195,7 +192,7 @@
</span><span class="cx"> if (!m_shouldReportDetails)
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- return resourceTimeToDocumentMilliseconds(m_timing.responseStart);
</del><ins>+ return networkLoadTimeToDOMHighResTimeStamp(m_timing.responseStart);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double PerformanceResourceTiming::responseEnd() const
</span><span class="lines">@@ -203,17 +200,16 @@
</span><span class="cx"> if (!m_shouldReportDetails)
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_loadTiming.responseEnd());
</del><ins>+ return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadTiming.responseEnd());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-double PerformanceResourceTiming::resourceTimeToDocumentMilliseconds(double deltaMilliseconds) const
</del><ins>+double PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp(double deltaMilliseconds) const
</ins><span class="cx"> {
</span><span class="cx"> if (!deltaMilliseconds)
</span><span class="cx"> return 0.0;
</span><span class="cx">
</span><del>- double documentStartTime = m_requestingDocument->loader()->timing().monotonicTimeToZeroBasedDocumentTime(m_loadTiming.fetchStart()) * 1000.0;
- double resourceTimeSeconds = (documentStartTime + deltaMilliseconds) / 1000.0;
- return 1000.0 * Performance::reduceTimeResolution(resourceTimeSeconds);
</del><ins>+ double seconds = m_loadTiming.fetchStart() + (deltaMilliseconds / 1000.0);
+ return Performance::reduceTimeResolution(seconds - m_timeOrigin) * 1000.0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceResourceTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.h (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceResourceTiming.h        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.h        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -41,19 +41,18 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class Document;
</del><ins>+class ResourceResponse;
+class SecurityOrigin;
</ins><span class="cx"> class URL;
</span><del>-class NetworkLoadTiming;
-class ResourceResponse;
</del><span class="cx">
</span><span class="cx"> class PerformanceResourceTiming final : public PerformanceEntry {
</span><span class="cx"> public:
</span><del>- static Ref<PerformanceResourceTiming> create(const AtomicString& initiatorType, const URL& originalURL, const ResourceResponse& response, LoadTiming loadTiming, Document* requestingDocument)
</del><ins>+ static Ref<PerformanceResourceTiming> create(const AtomicString& initiatorType, const URL& originalURL, const ResourceResponse& response, const SecurityOrigin& initiatorSecurityOrigin, double timeOrigin, LoadTiming loadTiming)
</ins><span class="cx"> {
</span><del>- return adoptRef(*new PerformanceResourceTiming(initiatorType, originalURL, response, loadTiming, requestingDocument));
</del><ins>+ return adoptRef(*new PerformanceResourceTiming(initiatorType, originalURL, response, initiatorSecurityOrigin, timeOrigin, loadTiming));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- AtomicString initiatorType() const;
</del><ins>+ AtomicString initiatorType() const { return m_initiatorType; }
</ins><span class="cx">
</span><span class="cx"> double workerStart() const;
</span><span class="cx"> double redirectStart() const;
</span><span class="lines">@@ -71,16 +70,16 @@
</span><span class="cx"> bool isResource() const override { return true; }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- PerformanceResourceTiming(const AtomicString& initatorType, const URL& originalURL, const ResourceResponse&, LoadTiming, Document*);
</del><ins>+ PerformanceResourceTiming(const AtomicString& initatorType, const URL& originalURL, const ResourceResponse&, const SecurityOrigin&, double timeOrigin, LoadTiming);
</ins><span class="cx"> ~PerformanceResourceTiming();
</span><span class="cx">
</span><del>- double resourceTimeToDocumentMilliseconds(double deltaMilliseconds) const;
</del><ins>+ double networkLoadTimeToDOMHighResTimeStamp(double deltaMilliseconds) const;
</ins><span class="cx">
</span><span class="cx"> AtomicString m_initiatorType;
</span><span class="cx"> NetworkLoadTiming m_timing;
</span><span class="cx"> LoadTiming m_loadTiming;
</span><span class="cx"> bool m_shouldReportDetails;
</span><del>- RefPtr<Document> m_requestingDocument;
</del><ins>+ double m_timeOrigin;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceUserTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceUserTiming.cpp (211526 => 211527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceUserTiming.cpp        2017-02-01 22:02:04 UTC (rev 211526)
+++ trunk/Source/WebCore/page/PerformanceUserTiming.cpp        2017-02-01 22:08:21 UTC (rev 211527)
</span><span class="lines">@@ -117,10 +117,16 @@
</span><span class="cx"> return m_marksMap.get(markName).last()->startTime();
</span><span class="cx">
</span><span class="cx"> if (auto function = restrictedMarkFunction(markName)) {
</span><del>- double value = static_cast<double>((m_performance.timing().*(function))());
- if (!value)
- return Exception { INVALID_ACCESS_ERR };
- return value - m_performance.timing().navigationStart();
</del><ins>+ if (PerformanceTiming* timing = m_performance.timing()) {
+ double value = static_cast<double>(((*timing).*(function))());
+ if (!value)
+ return Exception { INVALID_ACCESS_ERR };
+ return value - timing->navigationStart();
+ } else {
+ // FIXME: Support UserTiming in Workers.
+ ASSERT_NOT_REACHED();
+ return Exception { SYNTAX_ERR };
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return Exception { SYNTAX_ERR };
</span></span></pre>
</div>
</div>
</body>
</html>