From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/page/Performance.h | 109 ++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 52 deletions(-) (limited to 'Source/WebCore/page/Performance.h') diff --git a/Source/WebCore/page/Performance.h b/Source/WebCore/page/Performance.h index 19c995bae..01654f392 100644 --- a/Source/WebCore/page/Performance.h +++ b/Source/WebCore/page/Performance.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2010 Google Inc. All rights reserved. * Copyright (C) 2012 Intel Inc. All rights reserved. + * Copyright (C) 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,89 +30,93 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Performance_h -#define Performance_h +#pragma once #if ENABLE(WEB_TIMING) -#include "DOMWindowProperty.h" +#include "ContextDestructionObserver.h" #include "EventTarget.h" -#include "PerformanceEntryList.h" -#include "PerformanceNavigation.h" -#include "PerformanceTiming.h" -#include "ScriptWrappable.h" -#include -#include -#include -#include +#include "ExceptionOr.h" +#include "GenericTaskQueue.h" +#include namespace WebCore { -class Document; -class ResourceRequest; +class LoadTiming; +class PerformanceEntry; +class PerformanceNavigation; +class PerformanceObserver; +class PerformanceTiming; class ResourceResponse; +class ResourceTiming; +class ScriptExecutionContext; +class URL; class UserTiming; -class Performance final : public ScriptWrappable, public RefCounted, public DOMWindowProperty, public EventTargetWithInlineData { +class Performance final : public RefCounted, public ContextDestructionObserver, public EventTargetWithInlineData { public: - static PassRefPtr create(Frame* frame) { return adoptRef(new Performance(frame)); } + static Ref create(ScriptExecutionContext& context, MonotonicTime timeOrigin) { return adoptRef(*new Performance(context, timeOrigin)); } ~Performance(); - virtual EventTargetInterface eventTargetInterface() const override { return PerformanceEventTargetInterfaceType; } - virtual ScriptExecutionContext* scriptExecutionContext() const override; - - PerformanceNavigation* navigation() const; - PerformanceTiming* timing() const; double now() const; -#if ENABLE(PERFORMANCE_TIMELINE) - PassRefPtr webkitGetEntries() const; - PassRefPtr webkitGetEntriesByType(const String& entryType); - PassRefPtr webkitGetEntriesByName(const String& name, const String& entryType); -#endif + PerformanceNavigation* navigation(); + PerformanceTiming* timing(); + + Vector> getEntries() const; + Vector> getEntriesByType(const String& entryType) const; + Vector> getEntriesByName(const String& name, const String& entryType) const; + + void clearResourceTimings(); + void setResourceTimingBufferSize(unsigned); -#if ENABLE(RESOURCE_TIMING) - void webkitClearResourceTimings(); - void webkitSetResourceTimingBufferSize(unsigned int); + ExceptionOr mark(const String& markName); + void clearMarks(const String& markName); - DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); + ExceptionOr measure(const String& measureName, const String& startMark, const String& endMark); + void clearMeasures(const String& measureName); - void addResourceTiming(const String& initiatorName, Document*, const ResourceRequest&, const ResourceResponse&, double initiationTime, double finishTime); -#endif + void addResourceTiming(ResourceTiming&&); - using RefCounted::ref; - using RefCounted::deref; + void registerPerformanceObserver(PerformanceObserver&); + void unregisterPerformanceObserver(PerformanceObserver&); -#if ENABLE(USER_TIMING) - void webkitMark(const String& markName, ExceptionCode&); - void webkitClearMarks(const String& markName); + static Seconds reduceTimeResolution(Seconds); - void webkitMeasure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&); - void webkitClearMeasures(const String& measureName); -#endif // ENABLE(USER_TIMING) + ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } + + using RefCounted::ref; + using RefCounted::deref; private: - explicit Performance(Frame*); + Performance(ScriptExecutionContext&, MonotonicTime timeOrigin); + + void contextDestroyed() override; + + EventTargetInterface eventTargetInterface() const final { return PerformanceEventTargetInterfaceType; } - virtual void refEventTarget() override { ref(); } - virtual void derefEventTarget() override { deref(); } - bool isResourceTimingBufferFull(); + void refEventTarget() final { ref(); } + void derefEventTarget() final { deref(); } + + bool isResourceTimingBufferFull() const; + + void queueEntry(PerformanceEntry&); mutable RefPtr m_navigation; mutable RefPtr m_timing; - -#if ENABLE(RESOURCE_TIMING) + + // https://w3c.github.io/resource-timing/#extensions-performance-interface recommends size of 150. Vector> m_resourceTimingBuffer; - unsigned m_resourceTimingBufferSize; -#endif + unsigned m_resourceTimingBufferSize { 150 }; -#if ENABLE(USER_TIMING) - RefPtr m_userTiming; -#endif // ENABLE(USER_TIMING) + MonotonicTime m_timeOrigin; + + std::unique_ptr m_userTiming; + + GenericTaskQueue m_performanceTimelineTaskQueue; + ListHashSet> m_observers; }; } #endif // ENABLE(WEB_TIMING) - -#endif // Performance_h -- cgit v1.2.1