PerformanceUserTiming.h [plain text]
#ifndef PerformanceUserTiming_h
#define PerformanceUserTiming_h
#if ENABLE(USER_TIMING)
#include "EventException.h"
#include "ExceptionCode.h"
#include "Performance.h"
#include "PerformanceTiming.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 Performance;
class PerformanceEntry;
typedef unsigned long long (PerformanceTiming::*NavigationTimingFunction)() const;
typedef HashMap<String, Vector<RefPtr<PerformanceEntry> > > PerformanceEntryMap;
class UserTiming : public RefCounted<UserTiming> {
public:
static Ref<UserTiming> create(Performance* performance) { return adoptRef(*new UserTiming(performance)); }
void mark(const String& markName, ExceptionCode&);
void clearMarks(const String& markName);
void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&);
void clearMeasures(const String& measureName);
Vector<RefPtr<PerformanceEntry> > getMarks() const;
Vector<RefPtr<PerformanceEntry> > getMeasures() const;
Vector<RefPtr<PerformanceEntry> > getMarks(const String& name) const;
Vector<RefPtr<PerformanceEntry> > getMeasures(const String& name) const;
private:
explicit UserTiming(Performance*);
double findExistingMarkStartTime(const String& markName, ExceptionCode&);
Performance* m_performance;
PerformanceEntryMap m_marksMap;
PerformanceEntryMap m_measuresMap;
};
}
#endif // ENABLE(USER_TIMING)
#endif // !defined(PerformanceUserTiming_h)