| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef OriginsUsingFeatures_h | 5 #ifndef OriginsUsingFeatures_h |
| 6 #define OriginsUsingFeatures_h | 6 #define OriginsUsingFeatures_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
| 11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
| 12 #include "wtf/text/StringHash.h" | 12 #include "wtf/text/StringHash.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class Document; | 17 class Document; |
| 18 class EventTarget; | 18 class EventTarget; |
| 19 class ScriptState; | 19 class ScriptState; |
| 20 | 20 |
| 21 class CORE_EXPORT OriginsUsingFeatures { | 21 class CORE_EXPORT OriginsUsingFeatures { |
| 22 DISALLOW_ALLOCATION(); | 22 DISALLOW_NEW(); |
| 23 public: | 23 public: |
| 24 ~OriginsUsingFeatures(); | 24 ~OriginsUsingFeatures(); |
| 25 | 25 |
| 26 // Features for RAPPOR. Do not reorder or remove! | 26 // Features for RAPPOR. Do not reorder or remove! |
| 27 enum class Feature { | 27 enum class Feature { |
| 28 ElementCreateShadowRoot, | 28 ElementCreateShadowRoot, |
| 29 DocumentRegisterElement, | 29 DocumentRegisterElement, |
| 30 EventPath, | 30 EventPath, |
| 31 DeviceMotionInsecureOrigin, | 31 DeviceMotionInsecureOrigin, |
| 32 DeviceOrientationInsecureOrigin, | 32 DeviceOrientationInsecureOrigin, |
| 33 FullscreenInsecureOrigin, | 33 FullscreenInsecureOrigin, |
| 34 GeolocationInsecureOrigin, | 34 GeolocationInsecureOrigin, |
| 35 GetUserMediaInsecureOrigin, | 35 GetUserMediaInsecureOrigin, |
| 36 GetUserMediaSecureOrigin, | 36 GetUserMediaSecureOrigin, |
| 37 ElementAttachShadow, | 37 ElementAttachShadow, |
| 38 | 38 |
| 39 NumberOfFeatures // This must be the last item. | 39 NumberOfFeatures // This must be the last item. |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 static void countAnyWorld(Document&, Feature); | 42 static void countAnyWorld(Document&, Feature); |
| 43 static void countMainWorldOnly(const ScriptState*, Document&, Feature); | 43 static void countMainWorldOnly(const ScriptState*, Document&, Feature); |
| 44 static void countOriginOrIsolatedWorldHumanReadableName(const ScriptState*,
EventTarget&, Feature); | 44 static void countOriginOrIsolatedWorldHumanReadableName(const ScriptState*,
EventTarget&, Feature); |
| 45 | 45 |
| 46 void documentDetached(Document&); | 46 void documentDetached(Document&); |
| 47 void updateMeasurementsAndClear(); | 47 void updateMeasurementsAndClear(); |
| 48 | 48 |
| 49 class CORE_EXPORT Value { | 49 class CORE_EXPORT Value { |
| 50 ALLOW_ONLY_INLINE_ALLOCATION(); | 50 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 51 public: | 51 public: |
| 52 Value(); | 52 Value(); |
| 53 | 53 |
| 54 bool isEmpty() const { return !m_countBits; } | 54 bool isEmpty() const { return !m_countBits; } |
| 55 void clear() { m_countBits = 0; } | 55 void clear() { m_countBits = 0; } |
| 56 | 56 |
| 57 void count(Feature); | 57 void count(Feature); |
| 58 bool get(Feature feature) const { return m_countBits & (1 << static_cast
<unsigned>(feature)); } | 58 bool get(Feature feature) const { return m_countBits & (1 << static_cast
<unsigned>(feature)); } |
| 59 | 59 |
| 60 void aggregate(Value); | 60 void aggregate(Value); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 73 void recordOriginsToRappor(); | 73 void recordOriginsToRappor(); |
| 74 void recordNamesToRappor(); | 74 void recordNamesToRappor(); |
| 75 | 75 |
| 76 Vector<std::pair<String, OriginsUsingFeatures::Value>, 1> m_originAndValues; | 76 Vector<std::pair<String, OriginsUsingFeatures::Value>, 1> m_originAndValues; |
| 77 HashMap<String, OriginsUsingFeatures::Value> m_valueByName; | 77 HashMap<String, OriginsUsingFeatures::Value> m_valueByName; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| 81 | 81 |
| 82 #endif // OriginsUsingFeatures_h | 82 #endif // OriginsUsingFeatures_h |
| OLD | NEW |