Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: Source/core/timing/PerformanceEntry.h

Issue 1198863006: First version of PerformanceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch from microtask to timer for firing events. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698