LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 { | 50 { |
51 mSelectors.insert(mSelectors.end(), | 51 mSelectors.insert(mSelectors.end(), |
52 list.mSelectors.cbegin(), list.mSelectors.cend()); | 52 list.mSelectors.cbegin(), list.mSelectors.cend()); |
53 } | 53 } |
54 }; | 54 }; |
55 | 55 |
56 class ElemHide : public ref_counted | 56 class ElemHide : public ref_counted |
57 { | 57 { |
58 // All filters. Key is filter text. Exception filters excluded. | 58 // All filters. Key is filter text. Exception filters excluded. |
59 StringMap<ElemHideBasePtr> mFilters; | 59 StringMap<ElemHideBasePtr> mFilters; |
60 // StringMap is non copyable. std::unordered_map<> it is | 60 // Filters by domain. Key is domain. |
61 // Filters by domain. Key is domain. Subkey is filter text. | 61 // In value key is filter text, value is filter or NULL |
62 StringMap<StringMap<ElemHideBasePtr>> mFiltersByDomain; | 62 OwnedStringMap<OwnedStringMap<ElemHideBasePtr>> mFiltersByDomain; |
63 | 63 |
64 // Exceptions. The key is the selector. | 64 // Exceptions. The key is the selector. |
65 OwnedStringMap<std::vector<ElemHideExceptionPtr>> mExceptions; | 65 OwnedStringMap<std::vector<ElemHideExceptionPtr>> mExceptions; |
66 // Known exceptions. Filter text as keys. | 66 // Known exceptions. Filter text as keys. |
67 StringSet mKnownExceptions; | 67 StringSet mKnownExceptions; |
68 | 68 |
69 // Unconditional selectors. Filter selector as key. Filter as value. | 69 // Unconditional selectors. Filter selector as key. Filter as value. |
70 OwnedStringMap<ElemHideBasePtr> mUnconditionalSelectors; | 70 OwnedStringMap<ElemHideBasePtr> mUnconditionalSelectors; |
71 | 71 |
72 mutable intrusive_ptr<ElemHide_SelectorList> mUnconditionalSelectorsCache; | 72 mutable intrusive_ptr<ElemHide_SelectorList> mUnconditionalSelectorsCache; |
(...skipping 24 matching lines...) Expand all Loading... |
97 Criteria criter
ia) const; | 97 Criteria criter
ia) const; |
98 ElemHide_SelectorList* BINDINGS_EXPORTED GetUnconditionalSelectors() const; | 98 ElemHide_SelectorList* BINDINGS_EXPORTED GetUnconditionalSelectors() const; |
99 | 99 |
100 ElemHideException* BINDINGS_EXPORTED GetException(const ElemHideBase& filter, | 100 ElemHideException* BINDINGS_EXPORTED GetException(const ElemHideBase& filter, |
101 DependentString& docDomain)
const; | 101 DependentString& docDomain)
const; |
102 | 102 |
103 private: | 103 private: |
104 void AddToFiltersByDomain(const ElemHideBasePtr & filter); | 104 void AddToFiltersByDomain(const ElemHideBasePtr & filter); |
105 }; | 105 }; |
106 | 106 |
LEFT | RIGHT |