| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/dom/DOMHighResTimeStamp.h" | 37 #include "core/dom/DOMHighResTimeStamp.h" |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class ScriptState; | 43 class ScriptState; |
| 44 class ScriptValue; | 44 class ScriptValue; |
| 45 class V8ObjectBuilder; | 45 class V8ObjectBuilder; |
| 46 | 46 |
| 47 using PerformanceEntryType = unsigned char; | 47 using PerformanceEntryType = unsigned; |
| 48 using PerformanceEntryTypeMask = unsigned char; | 48 using PerformanceEntryTypeMask = unsigned; |
| 49 | 49 |
| 50 class CORE_EXPORT PerformanceEntry | 50 class CORE_EXPORT PerformanceEntry |
| 51 : public GarbageCollectedFinalized<PerformanceEntry>, | 51 : public GarbageCollectedFinalized<PerformanceEntry>, |
| 52 public ScriptWrappable { | 52 public ScriptWrappable { |
| 53 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
| 54 | 54 |
| 55 public: | 55 public: |
| 56 virtual ~PerformanceEntry(); | 56 virtual ~PerformanceEntry(); |
| 57 | 57 |
| 58 enum EntryType { | 58 enum EntryType : PerformanceEntryType { |
| 59 Invalid = 0, | 59 Invalid = 0, |
| 60 Navigation = 1 << 0, | 60 Navigation = 1 << 0, |
| 61 Composite = 1 << 1, | 61 Composite = 1 << 1, |
| 62 Mark = 1 << 2, | 62 Mark = 1 << 2, |
| 63 Measure = 1 << 3, | 63 Measure = 1 << 3, |
| 64 Render = 1 << 4, | 64 Render = 1 << 4, |
| 65 Resource = 1 << 5, | 65 Resource = 1 << 5, |
| 66 LongTask = 1 << 6, | 66 LongTask = 1 << 6, |
| 67 TaskAttribution = 1 << 7, | 67 TaskAttribution = 1 << 7, |
| 68 Paint = 1 << 8 |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 String name() const; | 71 String name() const; |
| 71 String entryType() const; | 72 String entryType() const; |
| 72 DOMHighResTimeStamp startTime() const; | 73 DOMHighResTimeStamp startTime() const; |
| 73 DOMHighResTimeStamp duration() const; | 74 DOMHighResTimeStamp duration() const; |
| 74 | 75 |
| 75 ScriptValue toJSONForBinding(ScriptState*) const; | 76 ScriptValue toJSONForBinding(ScriptState*) const; |
| 76 | 77 |
| 77 PerformanceEntryType entryTypeEnum() const { return m_entryTypeEnum; } | 78 PerformanceEntryType entryTypeEnum() const { return m_entryTypeEnum; } |
| 78 | 79 |
| 79 bool isResource() const { return m_entryTypeEnum == Resource; } | 80 bool isResource() const { return m_entryTypeEnum == Resource; } |
| 80 bool isRender() const { return m_entryTypeEnum == Render; } | 81 bool isRender() const { return m_entryTypeEnum == Render; } |
| 81 bool isComposite() const { return m_entryTypeEnum == Composite; } | 82 bool isComposite() const { return m_entryTypeEnum == Composite; } |
| 82 bool isMark() const { return m_entryTypeEnum == Mark; } | 83 bool isMark() const { return m_entryTypeEnum == Mark; } |
| 83 bool isMeasure() const { return m_entryTypeEnum == Measure; } | 84 bool isMeasure() const { return m_entryTypeEnum == Measure; } |
| 84 | 85 |
| 85 static bool startTimeCompareLessThan(PerformanceEntry* a, | 86 static bool startTimeCompareLessThan(PerformanceEntry* a, |
| 86 PerformanceEntry* b) { | 87 PerformanceEntry* b) { |
| 87 return a->startTime() < b->startTime(); | 88 return a->startTime() < b->startTime(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 static EntryType toEntryTypeEnum(const String& entryType); | 91 static PerformanceEntry::EntryType toEntryTypeEnum(const String& entryType); |
| 91 | 92 |
| 92 DEFINE_INLINE_VIRTUAL_TRACE() {} | 93 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 93 | 94 |
| 94 protected: | 95 protected: |
| 95 PerformanceEntry(const String& name, | 96 PerformanceEntry(const String& name, |
| 96 const String& entryType, | 97 const String& entryType, |
| 97 double startTime, | 98 double startTime, |
| 98 double finishTime); | 99 double finishTime); |
| 99 virtual void buildJSONValue(V8ObjectBuilder&) const; | 100 virtual void buildJSONValue(V8ObjectBuilder&) const; |
| 100 | 101 |
| 101 private: | 102 private: |
| 102 const String m_name; | 103 const String m_name; |
| 103 const String m_entryType; | 104 const String m_entryType; |
| 104 const double m_startTime; | 105 const double m_startTime; |
| 105 const double m_duration; | 106 const double m_duration; |
| 106 const PerformanceEntryType m_entryTypeEnum; | 107 const PerformanceEntryType m_entryTypeEnum; |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 } // namespace blink | 110 } // namespace blink |
| 110 | 111 |
| 111 #endif // PerformanceEntry_h | 112 #endif // PerformanceEntry_h |
| OLD | NEW |