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_t = unsigned char; |
| 46 |
45 class CORE_EXPORT PerformanceEntry : public GarbageCollectedFinalized<Performanc
eEntry>, public ScriptWrappable { | 47 class CORE_EXPORT PerformanceEntry : public GarbageCollectedFinalized<Performanc
eEntry>, public ScriptWrappable { |
46 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
47 public: | 49 public: |
48 virtual ~PerformanceEntry(); | 50 virtual ~PerformanceEntry(); |
49 | 51 |
| 52 enum EntryType { |
| 53 Invalid = 0, |
| 54 Composite = 1 << 1, |
| 55 Mark = 1 << 2, |
| 56 Measure = 1 << 3, |
| 57 Render = 1 << 4, |
| 58 Resource = 1 << 5, |
| 59 }; |
| 60 |
50 String name() const; | 61 String name() const; |
51 String entryType() const; | 62 String entryType() const; |
52 double startTime() const; | 63 double startTime() const; |
53 double duration() const; | 64 double duration() const; |
54 | 65 |
55 ScriptValue toJSONForBinding(ScriptState*) const; | 66 ScriptValue toJSONForBinding(ScriptState*) const; |
56 | 67 |
57 virtual bool isResource() { return false; } | 68 PerformanceEntryType_t entryTypeEnum() const { return m_entryTypeEnum; } |
58 virtual bool isRender() { return false; } | 69 |
59 virtual bool isComposite() { return false; } | 70 bool isResource() const { return m_entryTypeEnum == Resource; } |
60 virtual bool isMark() { return false; } | 71 bool isRender() const { return m_entryTypeEnum == Render; } |
61 virtual bool isMeasure() { return false; } | 72 bool isComposite() const { return m_entryTypeEnum == Composite; } |
| 73 bool isMark() const { return m_entryTypeEnum == Mark; } |
| 74 bool isMeasure() const { return m_entryTypeEnum == Measure; } |
62 | 75 |
63 static bool startTimeCompareLessThan(PerformanceEntry* a, PerformanceEntry*
b) | 76 static bool startTimeCompareLessThan(PerformanceEntry* a, PerformanceEntry*
b) |
64 { | 77 { |
65 return a->startTime() < b->startTime(); | 78 return a->startTime() < b->startTime(); |
66 } | 79 } |
67 | 80 |
| 81 static EntryType toEntryTypeEnum(const String& entryType); |
| 82 |
68 DEFINE_INLINE_VIRTUAL_TRACE() { } | 83 DEFINE_INLINE_VIRTUAL_TRACE() { } |
69 | 84 |
70 protected: | 85 protected: |
71 PerformanceEntry(const String& name, const String& entryType, double startTi
me, double finishTime); | 86 PerformanceEntry(const String& name, const String& entryType, double startTi
me, double finishTime); |
72 | 87 |
73 private: | 88 private: |
74 const String m_name; | 89 const String m_name; |
75 const String m_entryType; | 90 const String m_entryType; |
76 const double m_startTime; | 91 const double m_startTime; |
77 const double m_duration; | 92 const double m_duration; |
| 93 const PerformanceEntryType_t m_entryTypeEnum; |
78 }; | 94 }; |
79 | 95 |
80 } // namespace blink | 96 } // namespace blink |
81 | 97 |
82 #endif // PerformanceEntry_h | 98 #endif // PerformanceEntry_h |
OLD | NEW |