| 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 HostsUsingFeatures_h | 5 #ifndef HostsUsingFeatures_h |
| 6 #define HostsUsingFeatures_h | 6 #define HostsUsingFeatures_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 "platform/weborigin/KURL.h" |
| 10 #include "wtf/HashMap.h" | 11 #include "wtf/HashMap.h" |
| 11 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
| 12 #include "wtf/text/StringHash.h" | 13 #include "wtf/text/StringHash.h" |
| 13 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class Document; | 18 class Document; |
| 18 class EventTarget; | 19 class EventTarget; |
| 19 class ScriptState; | 20 class ScriptState; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 56 |
| 56 bool isEmpty() const { return !m_countBits; } | 57 bool isEmpty() const { return !m_countBits; } |
| 57 void clear() { m_countBits = 0; } | 58 void clear() { m_countBits = 0; } |
| 58 | 59 |
| 59 void count(Feature); | 60 void count(Feature); |
| 60 bool get(Feature feature) const { return m_countBits & (1 << static_cast
<unsigned>(feature)); } | 61 bool get(Feature feature) const { return m_countBits & (1 << static_cast
<unsigned>(feature)); } |
| 61 | 62 |
| 62 void aggregate(Value); | 63 void aggregate(Value); |
| 63 void recordHostToRappor(const String& host); | 64 void recordHostToRappor(const String& host); |
| 64 void recordNameToRappor(const String& name); | 65 void recordNameToRappor(const String& name); |
| 66 void recordETLDPlus1ToRappor(const KURL&); |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 unsigned m_countBits : static_cast<unsigned>(Feature::NumberOfFeatures); | 69 unsigned m_countBits : static_cast<unsigned>(Feature::NumberOfFeatures); |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 void countName(Feature, const String&); | 72 void countName(Feature, const String&); |
| 71 HashMap<String, Value>& valueByName() { return m_valueByName; } | 73 HashMap<String, Value>& valueByName() { return m_valueByName; } |
| 72 void clear(); | 74 void clear(); |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 void recordHostToRappor(); | 77 void recordHostToRappor(); |
| 76 void recordNamesToRappor(); | 78 void recordNamesToRappor(); |
| 79 void recordETLDPlus1ToRappor(); |
| 77 | 80 |
| 78 Vector<std::pair<String, HostsUsingFeatures::Value>, 1> m_hostAndValues; | 81 Vector<std::pair<KURL, HostsUsingFeatures::Value>, 1> m_urlAndValues; |
| 79 HashMap<String, HostsUsingFeatures::Value> m_valueByName; | 82 HashMap<String, HostsUsingFeatures::Value> m_valueByName; |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace blink | 85 } // namespace blink |
| 83 | 86 |
| 84 #endif // HostsUsingFeatures_h | 87 #endif // HostsUsingFeatures_h |
| OLD | NEW |