OLD | NEW |
(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 OriginsUsingFeatures_h |
| 6 #define OriginsUsingFeatures_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Vector.h" |
| 10 #include "wtf/text/WTFString.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class Document; |
| 15 class ScriptState; |
| 16 |
| 17 class OriginsUsingFeatures { |
| 18 DISALLOW_ALLOCATION(); |
| 19 public: |
| 20 ~OriginsUsingFeatures(); |
| 21 |
| 22 enum class Feature { |
| 23 ElementCreateShadowRoot, |
| 24 DocumentRegisterElement, |
| 25 |
| 26 NumberOfFeatures // This must be the last item. |
| 27 }; |
| 28 |
| 29 static void count(const ScriptState*, Document&, Feature); |
| 30 |
| 31 void documentDetached(Document&); |
| 32 void updateMeasurementsAndClear(); |
| 33 |
| 34 class Value { |
| 35 public: |
| 36 Value(); |
| 37 |
| 38 bool isEmpty() const { return !m_countBits; } |
| 39 void clear() { m_countBits = 0; } |
| 40 |
| 41 void count(Feature); |
| 42 bool get(Feature feature) const { return m_countBits & (1 << static_cast
<unsigned>(feature)); } |
| 43 |
| 44 void aggregate(Value); |
| 45 void updateMeasurements(const String& origin); |
| 46 |
| 47 private: |
| 48 unsigned m_countBits : static_cast<unsigned>(Feature::NumberOfFeatures); |
| 49 }; |
| 50 |
| 51 private: |
| 52 Vector<std::pair<String, OriginsUsingFeatures::Value>, 1> m_originAndValues; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // OriginsUsingFeatures_h |
OLD | NEW |