#ifndef Performance_h
#define Performance_h
#include "bindings/v8/ScriptWrappable.h"
#include "core/events/EventTarget.h"
#include "core/frame/DOMWindowProperty.h"
#include "core/timing/MemoryInfo.h"
#include "core/timing/PerformanceEntry.h"
#include "core/timing/PerformanceNavigation.h"
#include "core/timing/PerformanceTiming.h"
#include "heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class Document;
class ExceptionState;
class ResourceRequest;
class ResourceResponse;
class ResourceTimingInfo;
class UserTiming;
typedef WillBeHeapVector<RefPtrWillBeMember<PerformanceEntry> > PerformanceEntryVector;
class Performance FINAL : public RefCountedWillBeRefCountedGarbageCollected<Performance>, public ScriptWrappable, public DOMWindowProperty, public EventTargetWithInlineData {
DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<Performance>);
public:
static PassRefPtrWillBeRawPtr<Performance> create(LocalFrame* frame)
{
return adoptRefWillBeRefCountedGarbageCollected(new Performance(frame));
}
virtual ~Performance();
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual ExecutionContext* executionContext() const OVERRIDE;
PassRefPtrWillBeRawPtr<MemoryInfo> memory() const;
PerformanceNavigation* navigation() const;
PerformanceTiming* timing() const;
double now() const;
PerformanceEntryVector getEntries() const;
PerformanceEntryVector getEntriesByType(const String& entryType);
PerformanceEntryVector getEntriesByName(const String& name, const String& entryType);
void webkitClearResourceTimings();
void webkitSetResourceTimingBufferSize(unsigned);
DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
void addResourceTiming(const ResourceTimingInfo&, Document*);
void mark(const String& markName, ExceptionState&);
void clearMarks(const String& markName);
void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
void clearMeasures(const String& measureName);
void trace(Visitor*);
private:
explicit Performance(LocalFrame*);
bool isResourceTimingBufferFull();
void addResourceTimingBuffer(PassRefPtrWillBeRawPtr<PerformanceEntry>);
mutable RefPtrWillBeMember<PerformanceNavigation> m_navigation;
mutable RefPtrWillBeMember<PerformanceTiming> m_timing;
PerformanceEntryVector m_resourceTimingBuffer;
unsigned m_resourceTimingBufferSize;
double m_referenceTime;
RefPtrWillBeMember<UserTiming> m_userTiming;
};
}
#endif