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

Side by Side Diff: Source/core/timing/PerformanceBase.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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
37 #include "core/timing/PerformanceEntry.h" 37 #include "core/timing/PerformanceEntry.h"
38 #include "platform/heap/Handle.h" 38 #include "platform/heap/Handle.h"
39 #include "wtf/RefCounted.h" 39 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 #include "wtf/text/WTFString.h" 41 #include "wtf/text/WTFString.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class Document; 45 class Document;
46 class ExceptionState; 46 class ExceptionState;
47 class PerformanceObserver;
47 class PerformanceTiming; 48 class PerformanceTiming;
48 class ResourceTimingInfo; 49 class ResourceTimingInfo;
49 class UserTiming; 50 class UserTiming;
50 51
51 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; 52 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>;
53 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>;
52 54
53 class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTarget WithInlineData<PerformanceBase> { 55 class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTarget WithInlineData<PerformanceBase> {
54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase); 56 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase);
55 public: 57 public:
56 ~PerformanceBase() override; 58 ~PerformanceBase() override;
57 59
58 const AtomicString& interfaceName() const override; 60 const AtomicString& interfaceName() const override;
59 61
60 virtual PerformanceTiming* timing() const; 62 virtual PerformanceTiming* timing() const;
61 double now() const; 63 double now() const;
(...skipping 19 matching lines...) Expand all
81 void addRenderTiming(Document*, unsigned, double, double); 83 void addRenderTiming(Document*, unsigned, double, double);
82 84
83 void addCompositeTiming(Document*, unsigned, double); 85 void addCompositeTiming(Document*, unsigned, double);
84 86
85 void mark(const String& markName, ExceptionState&); 87 void mark(const String& markName, ExceptionState&);
86 void clearMarks(const String& markName); 88 void clearMarks(const String& markName);
87 89
88 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&); 90 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&);
89 void clearMeasures(const String& measureName); 91 void clearMeasures(const String& measureName);
90 92
93 void unregisterPerformanceObserver(PerformanceObserver*);
esprehn 2015/07/24 08:23:12 These should all take references.
MikeB 2015/07/24 19:30:38 Done.
94 void registerPerformanceObserver(PerformanceObserver*);
95
91 DECLARE_VIRTUAL_TRACE(); 96 DECLARE_VIRTUAL_TRACE();
92 97
93 protected: 98 protected:
99
94 explicit PerformanceBase(double timeOrigin); 100 explicit PerformanceBase(double timeOrigin);
95 bool isResourceTimingBufferFull(); 101 bool isResourceTimingBufferFull();
96 void addResourceTimingBuffer(PerformanceEntry*); 102 void addResourceTimingBuffer(PerformanceEntry*);
97 103
98 bool isFrameTimingBufferFull(); 104 bool isFrameTimingBufferFull();
99 void addFrameTimingBuffer(PerformanceEntry*); 105 void addFrameTimingBuffer(PerformanceEntry*);
100 106
107 void notifyObserversOfEntry(PerformanceEntry*);
esprehn 2015/07/24 08:23:12 ditto
MikeB 2015/07/24 19:30:38 Done.
108 bool hasObserverFor(PerformanceEntry::EntryType);
109
101 PerformanceEntryVector m_frameTimingBuffer; 110 PerformanceEntryVector m_frameTimingBuffer;
102 unsigned m_frameTimingBufferSize; 111 unsigned m_frameTimingBufferSize;
103 PerformanceEntryVector m_resourceTimingBuffer; 112 PerformanceEntryVector m_resourceTimingBuffer;
104 unsigned m_resourceTimingBufferSize; 113 unsigned m_resourceTimingBufferSize;
105 double m_timeOrigin; 114 double m_timeOrigin;
106 115
107 Member<UserTiming> m_userTiming; 116 Member<UserTiming> m_userTiming;
117
118 PerformanceEntryType_t m_observerFilterOptions;
esprehn 2015/07/24 08:23:12 Remove _t, we don't use that naming in blink.
MikeB 2015/07/24 19:30:38 Done.
119 PerformanceObservers m_observers;
108 }; 120 };
109 121
110 } // namespace blink 122 } // namespace blink
111 123
112 #endif // PerformanceBase_h 124 #endif // PerformanceBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698