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

Unified Diff: Source/core/timing/PerformanceObserverRegistration.h

Issue 1198863006: First version of PerformanceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync with latest spec draft (DOMString -> PerformanceEntryType and new PerformanceObserver -> windo… 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/timing/PerformanceObserverRegistration.h
diff --git a/Source/core/timing/PerformanceObserverRegistration.h b/Source/core/timing/PerformanceObserverRegistration.h
new file mode 100644
index 0000000000000000000000000000000000000000..32cbcda1064073c58651fc2eba1f727153f19e2e
--- /dev/null
+++ b/Source/core/timing/PerformanceObserverRegistration.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2015 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PerformanceObserverRegistration_h
+#define PerformanceObserverRegistration_h
+
+#include "core/timing/PerformanceObserver.h"
+#include "platform/heap/Handle.h"
+#include "wtf/HashSet.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/AtomicStringHash.h"
+
+namespace blink {
+
+class PerformanceBase;
+
+class PerformanceObserverRegistration final : public GarbageCollectedFinalized<PerformanceObserverRegistration> {
+public:
+ static PerformanceObserverRegistration* create(PerformanceObserver&, PerformanceBase*, const HashSet<AtomicString>& typeFilter);
esprehn 2015/07/18 22:24:16 Why the PerformanceBase argument? The observer sho
MikeB 2015/07/20 23:06:50 Got rid of this class entirely. Simplifies things
+ ~PerformanceObserverRegistration();
+
+ void resetObservation(const HashSet<AtomicString>& typeFilter);
+
+ void unregister();
+
+ PerformanceObserver& observer() const { return *m_observer; }
+ PerformanceBase* performance() const { return m_performance.get(); }
esprehn 2015/07/18 22:24:16 Can this be null? i don't think it can, you want *
+
+ DECLARE_TRACE();
+
+ void dispose();
+
+ void addReference() { ++m_referenceCount; }
esprehn 2015/07/18 22:24:16 This manual reference count is very weird, what ar
+
+ bool shouldReceiveEntryFrom(const AtomicString& typeName) const;
+
+private:
+ PerformanceObserverRegistration(PerformanceObserver&, PerformanceBase*, const HashSet<AtomicString>& typeFilter);
+
+ Member<PerformanceObserver> m_observer;
+ WeakMember<PerformanceBase> m_performance;
esprehn 2015/07/18 22:24:16 the observer should know the performance.
+
+ HashSet<AtomicString> m_typeFilter;
esprehn 2015/07/18 22:24:17 This should be an unsigned bitfield where each bit
+ unsigned m_referenceCount;
+};
+
+} // namespace blink
+
+#endif // PerformanceObserverRegistration_h

Powered by Google App Engine
This is Rietveld 408576698