#ifndef PerformanceUserTiming_h
#define PerformanceUserTiming_h
#include "core/timing/Performance.h"
#include "core/timing/PerformanceTiming.h"
#include "heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class ExceptionState;
class Performance;
class PerformanceEntry;
typedef unsigned long long (PerformanceTiming::*NavigationTimingFunction)() const;
typedef WillBeHeapHashMap<String, PerformanceEntryVector> PerformanceEntryMap;
class UserTiming : public RefCountedWillBeGarbageCollected<UserTiming> {
public:
static PassRefPtrWillBeRawPtr<UserTiming> create(Performance* performance)
{
return adoptRefWillBeNoop(new UserTiming(performance));
}
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);
PerformanceEntryVector getMarks() const;
PerformanceEntryVector getMeasures() const;
PerformanceEntryVector getMarks(const String& name) const;
PerformanceEntryVector getMeasures(const String& name) const;
void trace(Visitor*);
private:
explicit UserTiming(Performance*);
double findExistingMarkStartTime(const String& markName, ExceptionState&);
RawPtrWillBeMember<Performance> m_performance;
PerformanceEntryMap m_marksMap;
PerformanceEntryMap m_measuresMap;
};
}
#endif