Diff
Modified: trunk/Source/WebCore/ChangeLog (211073 => 211074)
--- trunk/Source/WebCore/ChangeLog 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/ChangeLog 2017-01-24 03:12:53 UTC (rev 211074)
@@ -1,3 +1,38 @@
+2017-01-23 Joseph Pecoraro <[email protected]>
+
+ Cleanup WEB_TIMING code
+ https://bugs.webkit.org/show_bug.cgi?id=167339
+
+ Reviewed by Alex Christensen.
+
+ Stylistic cleanup to WEB_TIMING related code.
+
+ * bindings/js/JSPerformanceEntryCustom.cpp:
+ * loader/ResourceTimingInformation.cpp:
+ * loader/ResourceTimingInformation.h:
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::didFinishLoading):
+ * page/Performance.cpp:
+ (WebCore::Performance::getEntries):
+ (WebCore::Performance::getEntriesByType):
+ (WebCore::Performance::setResourceTimingBufferSize):
+ (WebCore::Performance::isResourceTimingBufferFull):
+ * page/Performance.h:
+ * page/PerformanceMark.h:
+ * page/PerformanceMeasure.h:
+ * page/PerformanceNavigation.h:
+ * page/PerformanceResourceTiming.cpp:
+ (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
+ (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
+ * page/PerformanceResourceTiming.h:
+ * page/PerformanceTiming.cpp:
+ (WebCore::PerformanceTiming::documentLoader):
+ (WebCore::PerformanceTiming::documentTiming):
+ (WebCore::PerformanceTiming::loadTiming):
+ * page/PerformanceTiming.h:
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::ResourceHandle::createCFURLConnection):
+
2017-01-23 Alex Christensen <[email protected]>
URLParser should fail to parse percent-encoded invalid UTF-8 sequences
Modified: trunk/Source/WebCore/bindings/js/JSPerformanceEntryCustom.cpp (211073 => 211074)
--- trunk/Source/WebCore/bindings/js/JSPerformanceEntryCustom.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/bindings/js/JSPerformanceEntryCustom.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -31,18 +31,20 @@
#include "config.h"
#if ENABLE(WEB_TIMING)
+
#include "JSPerformanceEntry.h"
#include "JSDOMBinding.h"
-#if ENABLE(USER_TIMING)
-#include "JSPerformanceMark.h"
-#include "JSPerformanceMeasure.h"
-#endif
#include "JSPerformanceResourceTiming.h"
#include "PerformanceMark.h"
#include "PerformanceMeasure.h"
#include "PerformanceResourceTiming.h"
+#if ENABLE(USER_TIMING)
+#include "JSPerformanceMark.h"
+#include "JSPerformanceMeasure.h"
+#endif
+
using namespace JSC;
namespace WebCore {
Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.cpp (211073 => 211074)
--- trunk/Source/WebCore/loader/ResourceTimingInformation.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -24,11 +24,11 @@
*/
#include "config.h"
-#if ENABLE(WEB_TIMING)
#include "ResourceTimingInformation.h"
+#if ENABLE(WEB_TIMING)
+
#include "CachedResource.h"
-#include "CachedResourceRequest.h"
#include "DOMWindow.h"
#include "Document.h"
#include "Frame.h"
Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.h (211073 => 211074)
--- trunk/Source/WebCore/loader/ResourceTimingInformation.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -34,7 +34,6 @@
namespace WebCore {
class CachedResource;
-class CachedResourceRequest;
class Document;
class Frame;
class LoadTiming;
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (211073 => 211074)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -540,8 +540,10 @@
m_loadTiming.setResponseEnd(responseEndTime);
#if ENABLE(WEB_TIMING)
- if (m_documentLoader->cachedResourceLoader().document() && RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
- m_documentLoader->cachedResourceLoader().resourceTimingInformation().addResourceTiming(m_resource, *m_documentLoader->cachedResourceLoader().document(), m_resource->loader()->loadTiming());
+ if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) {
+ if (Document* document = m_documentLoader->cachedResourceLoader().document())
+ m_documentLoader->cachedResourceLoader().resourceTimingInformation().addResourceTiming(m_resource, *document, m_resource->loader()->loadTiming());
+ }
#endif
m_state = Finishing;
Modified: trunk/Source/WebCore/page/Performance.cpp (211073 => 211074)
--- trunk/Source/WebCore/page/Performance.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/Performance.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -92,7 +92,7 @@
entries.appendVector(m_userTiming->getMarks());
entries.appendVector(m_userTiming->getMeasures());
}
-#endif // ENABLE(USER_TIMING)
+#endif
std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
return entries;
@@ -102,10 +102,8 @@
{
Vector<RefPtr<PerformanceEntry>> entries;
- if (equalLettersIgnoringASCIICase(entryType, "resource")) {
- for (auto& resource : m_resourceTimingBuffer)
- entries.append(resource);
- }
+ if (equalLettersIgnoringASCIICase(entryType, "resource"))
+ entries.appendVector(m_resourceTimingBuffer);
#if ENABLE(USER_TIMING)
if (m_userTiming) {
@@ -152,6 +150,7 @@
void Performance::setResourceTimingBufferSize(unsigned size)
{
m_resourceTimingBufferSize = size;
+
if (isResourceTimingBufferFull())
dispatchEvent(Event::create(eventNames().resourcetimingbufferfullEvent, false, false));
}
@@ -169,7 +168,7 @@
dispatchEvent(Event::create(eventNames().resourcetimingbufferfullEvent, false, false));
}
-bool Performance::isResourceTimingBufferFull()
+bool Performance::isResourceTimingBufferFull() const
{
return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize;
}
Modified: trunk/Source/WebCore/page/Performance.h (211073 => 211074)
--- trunk/Source/WebCore/page/Performance.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/Performance.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -89,7 +89,7 @@
void refEventTarget() final { ref(); }
void derefEventTarget() final { deref(); }
- bool isResourceTimingBufferFull();
+ bool isResourceTimingBufferFull() const;
mutable RefPtr<PerformanceNavigation> m_navigation;
mutable RefPtr<PerformanceTiming> m_timing;
Modified: trunk/Source/WebCore/page/PerformanceMark.h (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceMark.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceMark.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -39,7 +39,7 @@
bool isMark() const override { return true; }
private:
- PerformanceMark(const String& name, double startTime) : PerformanceEntry(name, "mark", startTime, startTime) { }
+ PerformanceMark(const String& name, double startTime) : PerformanceEntry(name, ASCIILiteral("mark"), startTime, startTime) { }
~PerformanceMark() { }
};
Modified: trunk/Source/WebCore/page/PerformanceMeasure.h (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceMeasure.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceMeasure.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -39,7 +39,7 @@
bool isMeasure() const override { return true; }
private:
- PerformanceMeasure(const String& name, double startTime, double duration) : PerformanceEntry(name, "measure", startTime, duration) { }
+ PerformanceMeasure(const String& name, double startTime, double duration) : PerformanceEntry(name, ASCIILiteral("measure"), startTime, duration) { }
~PerformanceMeasure() { }
};
Modified: trunk/Source/WebCore/page/PerformanceNavigation.h (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceNavigation.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceNavigation.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -60,4 +60,4 @@
} // namespace WebCore
-#endif // !ENABLE(WEB_TIMING)
+#endif // ENABLE(WEB_TIMING)
Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.cpp (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceResourceTiming.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -39,7 +39,6 @@
#include "HTTPHeaderNames.h"
#include "LoadTiming.h"
#include "URL.h"
-#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "SecurityOrigin.h"
#include <wtf/Vector.h>
@@ -77,7 +76,7 @@
}
PerformanceResourceTiming::PerformanceResourceTiming(const AtomicString& initiatorType, const URL& originalURL, const ResourceResponse& response, LoadTiming loadTiming, Document* requestingDocument)
- : PerformanceEntry(originalURL.string(), "resource", monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.startTime()), monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.responseEnd()))
+ : PerformanceEntry(originalURL.string(), ASCIILiteral("resource"), monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.startTime()), monotonicTimeToDocumentMilliseconds(requestingDocument, loadTiming.responseEnd()))
, m_initiatorType(initiatorType)
, m_timing(response.networkLoadTiming())
, m_loadTiming(loadTiming)
@@ -206,6 +205,7 @@
{
if (!deltaMilliseconds)
return 0.0;
+
double documentStartTime = m_requestingDocument->loader()->timing().monotonicTimeToZeroBasedDocumentTime(m_loadTiming.fetchStart()) * 1000.0;
double resourceTimeSeconds = (documentStartTime + deltaMilliseconds) / 1000.0;
return 1000.0 * Performance::reduceTimeResolution(resourceTimeSeconds);
@@ -212,4 +212,5 @@
}
} // namespace WebCore
+
#endif // ENABLE(WEB_TIMING)
Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.h (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceResourceTiming.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -44,7 +44,6 @@
class Document;
class URL;
class NetworkLoadTiming;
-class ResourceRequest;
class ResourceResponse;
class PerformanceResourceTiming final : public PerformanceEntry {
Modified: trunk/Source/WebCore/page/PerformanceTiming.cpp (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceTiming.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceTiming.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -307,7 +307,7 @@
DocumentLoader* PerformanceTiming::documentLoader() const
{
if (!m_frame)
- return 0;
+ return nullptr;
return m_frame->loader().documentLoader();
}
@@ -315,11 +315,11 @@
const DocumentTiming* PerformanceTiming::documentTiming() const
{
if (!m_frame)
- return 0;
+ return nullptr;
Document* document = m_frame->document();
if (!document)
- return 0;
+ return nullptr;
return &document->timing();
}
@@ -328,7 +328,7 @@
{
DocumentLoader* loader = documentLoader();
if (!loader)
- return 0;
+ return nullptr;
return &loader->timing();
}
Modified: trunk/Source/WebCore/page/PerformanceTiming.h (211073 => 211074)
--- trunk/Source/WebCore/page/PerformanceTiming.h 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/page/PerformanceTiming.h 2017-01-24 03:12:53 UTC (rev 211074)
@@ -81,4 +81,4 @@
} // namespace WebCore
-#endif // !ENABLE(WEB_TIMING)
+#endif // ENABLE(WEB_TIMING)
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (211073 => 211074)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2017-01-24 02:30:47 UTC (rev 211073)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2017-01-24 03:12:53 UTC (rev 211074)
@@ -221,6 +221,7 @@
propertiesDictionary = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, clientProperties));
else
propertiesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
#if HAVE(TIMINGDATAOPTIONS)
int64_t value = static_cast<int64_t>(_TimingDataOptionsEnableW3CNavigationTiming);
auto enableW3CNavigationTiming = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value));