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

Unified 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: Code review comments Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/timing/PerformanceMeasure.h ('k') | Source/core/timing/PerformanceObserver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/timing/PerformanceObserver.h
diff --git a/Source/core/timing/PerformanceObserver.h b/Source/core/timing/PerformanceObserver.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e6eacfcf33859dca85b106fbc6c41e93492635e
--- /dev/null
+++ b/Source/core/timing/PerformanceObserver.h
@@ -0,0 +1,60 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PerformanceObserver_h
+#define PerformanceObserver_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/timing/PerformanceEntry.h"
+#include "platform/heap/Handle.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+class ExceptionState;
+class PerformanceBase;
+class PerformanceObserverCallback;
+class PerformanceObserver;
+class PerformanceObserverInit;
+
+using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>;
+
+class PerformanceObserver final : public GarbageCollectedFinalized<PerformanceObserver>, public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+ friend class PerformanceBase;
+public:
+ static PerformanceObserver* create(PerformanceBase*, PerformanceObserverCallback*);
+ static void resumeSuspendedObservers();
+
+ ~PerformanceObserver();
+
+ void observe(const PerformanceObserverInit&, ExceptionState&);
+ void disconnect();
+ void enqueuePerformanceEntry(PerformanceEntry&);
+ PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; }
+
+ // Eagerly finalized as destructor accesses heap object members.
+ EAGERLY_FINALIZE();
+ DECLARE_TRACE();
+
+private:
+ explicit PerformanceObserver(PerformanceBase*, PerformanceObserverCallback*);
+ void deliver();
+ bool shouldBeSuspended() const;
+
+ Member<PerformanceObserverCallback> m_callback;
+ WeakMember<PerformanceBase> m_performance;
+ PerformanceEntryVector m_performanceEntries;
+ PerformanceEntryTypeMask m_filterOptions;
+ bool m_isRegistered;
+};
+
+} // namespace blink
+
+#endif // PerformanceObserver_h
« no previous file with comments | « Source/core/timing/PerformanceMeasure.h ('k') | Source/core/timing/PerformanceObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698