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

Unified Diff: Source/core/frame/OriginsUsingFeatures.h

Issue 986583002: Collect host of Web Component usage to send to RAPPOR (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix typo Created 5 years, 9 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/dom/Element.idl ('k') | Source/core/frame/OriginsUsingFeatures.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/OriginsUsingFeatures.h
diff --git a/Source/core/frame/OriginsUsingFeatures.h b/Source/core/frame/OriginsUsingFeatures.h
new file mode 100644
index 0000000000000000000000000000000000000000..179e2f9ce8052bcd89b5721074063f7ab9ed6501
--- /dev/null
+++ b/Source/core/frame/OriginsUsingFeatures.h
@@ -0,0 +1,57 @@
+// 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 OriginsUsingFeatures_h
+#define OriginsUsingFeatures_h
+
+#include "platform/heap/Handle.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+class Document;
+class ScriptState;
+
+class OriginsUsingFeatures {
+ DISALLOW_ALLOCATION();
+public:
+ ~OriginsUsingFeatures();
+
+ enum class Feature {
+ ElementCreateShadowRoot,
+ DocumentRegisterElement,
+
+ NumberOfFeatures // This must be the last item.
+ };
+
+ static void count(const ScriptState*, Document&, Feature);
+
+ void documentDetached(Document&);
+ void updateMeasurementsAndClear();
+
+ class Value {
+ public:
+ Value();
+
+ bool isEmpty() const { return !m_countBits; }
+ void clear() { m_countBits = 0; }
+
+ void count(Feature);
+ bool get(Feature feature) const { return m_countBits & (1 << static_cast<unsigned>(feature)); }
+
+ void aggregate(Value);
+ void updateMeasurements(const String& origin);
+
+ private:
+ unsigned m_countBits : static_cast<unsigned>(Feature::NumberOfFeatures);
+ };
+
+private:
+ Vector<std::pair<String, OriginsUsingFeatures::Value>, 1> m_originAndValues;
+};
+
+} // namespace blink
+
+#endif // OriginsUsingFeatures_h
« no previous file with comments | « Source/core/dom/Element.idl ('k') | Source/core/frame/OriginsUsingFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698