#ifndef Performance_h
#define Performance_h
#if ENABLE(WEB_TIMING)
#include "DOMWindowProperty.h"
#include "EventTarget.h"
#include "PerformanceEntryList.h"
#include "PerformanceNavigation.h"
#include "PerformanceTiming.h"
#include "ScriptWrappable.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class Document;
class ResourceRequest;
class ResourceResponse;
class UserTiming;
class Performance final : public RefCounted<Performance>, public DOMWindowProperty, public EventTargetWithInlineData {
public:
static Ref<Performance> create(Frame& frame) { return adoptRef(*new Performance(frame)); }
~Performance();
EventTargetInterface eventTargetInterface() const override { return PerformanceEventTargetInterfaceType; }
ScriptExecutionContext* scriptExecutionContext() const override;
PerformanceNavigation* navigation() const;
PerformanceTiming* timing() const;
double now() const;
RefPtr<PerformanceEntryList> getEntries() const;
RefPtr<PerformanceEntryList> getEntriesByType(const String& entryType);
RefPtr<PerformanceEntryList> getEntriesByName(const String& name, const String& entryType);
void clearResourceTimings();
void setResourceTimingBufferSize(unsigned);
void addResourceTiming(const String& initiatorName, Document*, const ResourceRequest&, const ResourceResponse&, double initiationTime, double finishTime);
using RefCounted<Performance>::ref;
using RefCounted<Performance>::deref;
#if ENABLE(USER_TIMING)
void webkitMark(const String& markName, ExceptionCode&);
void webkitClearMarks(const String& markName);
void webkitMeasure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&);
void webkitClearMeasures(const String& measureName);
#endif // ENABLE(USER_TIMING)
private:
explicit Performance(Frame&);
void refEventTarget() override { ref(); }
void derefEventTarget() override { deref(); }
bool isResourceTimingBufferFull();
mutable RefPtr<PerformanceNavigation> m_navigation;
mutable RefPtr<PerformanceTiming> m_timing;
Vector<RefPtr<PerformanceEntry>> m_resourceTimingBuffer;
unsigned m_resourceTimingBufferSize;
double m_referenceTime;
#if ENABLE(USER_TIMING)
RefPtr<UserTiming> m_userTiming;
#endif // ENABLE(USER_TIMING)
};
}
#endif // ENABLE(WEB_TIMING)
#endif // Performance_h