diff options
Diffstat (limited to 'Source/WebCore/page/PerformanceEntry.h')
-rw-r--r-- | Source/WebCore/page/PerformanceEntry.h | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/Source/WebCore/page/PerformanceEntry.h b/Source/WebCore/page/PerformanceEntry.h index 129a24640..7ebee6a4c 100644 --- a/Source/WebCore/page/PerformanceEntry.h +++ b/Source/WebCore/page/PerformanceEntry.h @@ -29,14 +29,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PerformanceEntry_h -#define PerformanceEntry_h +#pragma once -#if ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE) +#if ENABLE(WEB_TIMING) #include "Performance.h" -#include <wtf/PassRefPtr.h> +#include <wtf/Optional.h> #include <wtf/RefCounted.h> +#include <wtf/TypeCasts.h> #include <wtf/text/WTFString.h> namespace WebCore { @@ -45,31 +45,42 @@ class PerformanceEntry : public RefCounted<PerformanceEntry> { public: virtual ~PerformanceEntry(); - String name() const; - String entryType() const; - double startTime() const; - double duration() const; + String name() const { return m_name; } + String entryType() const { return m_entryType; } + double startTime() const { return m_startTime; } + double duration() const { return m_duration; } - virtual bool isResource() { return false; } - virtual bool isMark() { return false; } - virtual bool isMeasure() { return false; } + enum class Type { + Navigation = 1 << 0, + Mark = 1 << 1, + Measure = 1 << 2, + Resource = 1 << 3, + }; - static bool startTimeCompareLessThan(PassRefPtr<PerformanceEntry> a, PassRefPtr<PerformanceEntry> b) + Type type() const { return m_type; } + + static std::optional<Type> parseEntryTypeString(const String& entryType); + + virtual bool isResource() const { return false; } + virtual bool isMark() const { return false; } + virtual bool isMeasure() const { return false; } + + static bool startTimeCompareLessThan(const RefPtr<PerformanceEntry>& a, const RefPtr<PerformanceEntry>& b) { return a->startTime() < b->startTime(); } protected: - PerformanceEntry(const String& name, const String& entryType, double startTime, double finishTime); + PerformanceEntry(Type, const String& name, const String& entryType, double startTime, double finishTime); private: const String m_name; const String m_entryType; const double m_startTime; const double m_duration; + const Type m_type; }; -} +} // namespace WebCore -#endif // !ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE) -#endif // !defined(PerformanceEntry_h) +#endif // ENABLE(WEB_TIMING) |