| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/core/v8/ScriptWrappable.h" | 35 #include "bindings/core/v8/ScriptWrappable.h" |
| 36 #include "core/CoreExport.h" | 36 #include "core/CoreExport.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class ScriptState; | 42 class ScriptState; |
| 43 class ScriptValue; | 43 class ScriptValue; |
| 44 | 44 |
| 45 using PerformanceEntryType = unsigned char; |
| 46 using PerformanceEntryTypeMask = unsigned char; |
| 47 |
| 45 class CORE_EXPORT PerformanceEntry : public GarbageCollectedFinalized<Performanc
eEntry>, public ScriptWrappable { | 48 class CORE_EXPORT PerformanceEntry : public GarbageCollectedFinalized<Performanc
eEntry>, public ScriptWrappable { |
| 46 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
| 47 public: | 50 public: |
| 48 virtual ~PerformanceEntry(); | 51 virtual ~PerformanceEntry(); |
| 49 | 52 |
| 53 enum EntryType { |
| 54 Invalid = 0, |
| 55 Composite = 1 << 1, |
| 56 Mark = 1 << 2, |
| 57 Measure = 1 << 3, |
| 58 Render = 1 << 4, |
| 59 Resource = 1 << 5, |
| 60 }; |
| 61 |
| 50 String name() const; | 62 String name() const; |
| 51 String entryType() const; | 63 String entryType() const; |
| 52 double startTime() const; | 64 double startTime() const; |
| 53 double duration() const; | 65 double duration() const; |
| 54 | 66 |
| 55 ScriptValue toJSONForBinding(ScriptState*) const; | 67 ScriptValue toJSONForBinding(ScriptState*) const; |
| 56 | 68 |
| 57 virtual bool isResource() { return false; } | 69 PerformanceEntryType entryTypeEnum() const { return m_entryTypeEnum; } |
| 58 virtual bool isRender() { return false; } | 70 |
| 59 virtual bool isComposite() { return false; } | 71 bool isResource() const { return m_entryTypeEnum == Resource; } |
| 60 virtual bool isMark() { return false; } | 72 bool isRender() const { return m_entryTypeEnum == Render; } |
| 61 virtual bool isMeasure() { return false; } | 73 bool isComposite() const { return m_entryTypeEnum == Composite; } |
| 74 bool isMark() const { return m_entryTypeEnum == Mark; } |
| 75 bool isMeasure() const { return m_entryTypeEnum == Measure; } |
| 62 | 76 |
| 63 static bool startTimeCompareLessThan(PerformanceEntry* a, PerformanceEntry*
b) | 77 static bool startTimeCompareLessThan(PerformanceEntry* a, PerformanceEntry*
b) |
| 64 { | 78 { |
| 65 return a->startTime() < b->startTime(); | 79 return a->startTime() < b->startTime(); |
| 66 } | 80 } |
| 67 | 81 |
| 82 static EntryType toEntryTypeEnum(const String& entryType); |
| 83 |
| 68 DEFINE_INLINE_VIRTUAL_TRACE() { } | 84 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 69 | 85 |
| 70 protected: | 86 protected: |
| 71 PerformanceEntry(const String& name, const String& entryType, double startTi
me, double finishTime); | 87 PerformanceEntry(const String& name, const String& entryType, double startTi
me, double finishTime); |
| 72 | 88 |
| 73 private: | 89 private: |
| 74 const String m_name; | 90 const String m_name; |
| 75 const String m_entryType; | 91 const String m_entryType; |
| 76 const double m_startTime; | 92 const double m_startTime; |
| 77 const double m_duration; | 93 const double m_duration; |
| 94 const PerformanceEntryType m_entryTypeEnum; |
| 78 }; | 95 }; |
| 79 | 96 |
| 80 } // namespace blink | 97 } // namespace blink |
| 81 | 98 |
| 82 #endif // PerformanceEntry_h | 99 #endif // PerformanceEntry_h |
| OLD | NEW |