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

Side by Side Diff: Source/core/timing/PerformanceObserver.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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PerformanceObserver_h
6 #define PerformanceObserver_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/timing/PerformanceEntry.h"
10 #include "platform/heap/Handle.h"
11 #include "wtf/HashSet.h"
12 #include "wtf/PassOwnPtr.h"
13 #include "wtf/PassRefPtr.h"
14 #include "wtf/RefCounted.h"
15 #include "wtf/RefPtr.h"
16 #include "wtf/Vector.h"
17
18 namespace blink {
19
20 class ExceptionState;
21 class PerformanceBase;
22 class PerformanceObserverCallback;
23 class PerformanceObserver;
24 class PerformanceObserverInit;
25
26 using PerformanceObserverSet = HeapListHashSet<Member<PerformanceObserver>>;
27 using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>;
28 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>;
29
30 class PerformanceObserver final : public GarbageCollectedFinalized<PerformanceOb server>, public ScriptWrappable {
31 DEFINE_WRAPPERTYPEINFO();
32 friend class PerformanceObserverTimerCoordinator;
33 public:
34 static PerformanceObserver* create(PerformanceBase*, PerformanceObserverCall back*);
35 static void resumeSuspendedObservers();
36
37 ~PerformanceObserver();
38
39 void observe(const PerformanceObserverInit&, ExceptionState&);
40 void disconnect();
41 void enqueuePerformanceEntry(PerformanceEntry*);
42 PerformanceEntryType_t filterOptions() { return m_filterOptions; }
43
44 // Eagerly finalized as destructor accesses heap object members.
45 EAGERLY_FINALIZE();
46 DECLARE_TRACE();
47
48 private:
49 explicit PerformanceObserver(PerformanceBase*, PerformanceObserverCallback*) ;
50 void deliver();
51 bool shouldBeSuspended() const;
52
53 Member<PerformanceObserverCallback> m_callback;
54 WeakMember<PerformanceBase> m_performance;
55 PerformanceEntryVector m_performanceEntries;
56 PerformanceEntryType_t m_filterOptions;
57 bool m_isRegistered;
58 };
59
60 } // namespace blink
61
62 #endif // PerformanceObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698