#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/PassRefPtr.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 ScriptWrappable, public RefCounted<Performance>, public DOMWindowProperty, public EventTargetWithInlineData {
public:
static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); }
~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<PerformanceEntryList> webkitGetEntries() const;
PassRefPtr<PerformanceEntryList> webkitGetEntriesByType(const String& entryType);
PassRefPtr<PerformanceEntryList> webkitGetEntriesByName(const String& name, const String& entryType);
#endif
#if ENABLE(RESOURCE_TIMING)
void webkitClearResourceTimings();
void webkitSetResourceTimingBufferSize(unsigned int);
DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
void addResourceTiming(const String& initiatorName, Document*, const ResourceRequest&, const ResourceResponse&, double initiationTime, double finishTime);
#endif
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*);
virtual void refEventTarget() override { ref(); }
virtual void derefEventTarget() override { deref(); }
bool isResourceTimingBufferFull();
mutable RefPtr<PerformanceNavigation> m_navigation;
mutable RefPtr<PerformanceTiming> m_timing;
#if ENABLE(RESOURCE_TIMING)
Vector<RefPtr<PerformanceEntry>> m_resourceTimingBuffer;
unsigned m_resourceTimingBufferSize;
#endif
#if ENABLE(USER_TIMING)
RefPtr<UserTiming> m_userTiming;
#endif // ENABLE(USER_TIMING)
};
}
#endif // ENABLE(WEB_TIMING)
#endif // Performance_h