 Issue 29581602:
  Issue 5141 - [emscripten] Convert filter matcher to C++ 
  Base URL: https://hg.adblockplus.org/adblockpluscore
    
  
    Issue 29581602:
  Issue 5141 - [emscripten] Convert filter matcher to C++ 
  Base URL: https://hg.adblockplus.org/adblockpluscore| Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-present eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 #pragma once | |
| 19 | |
| 20 #include <vector> | |
| 21 | |
| 22 #include "../intrusive_ptr.h" | |
| 23 #include "../IntMap.h" | |
| 24 #include "../String.h" | |
| 25 #include "../filter/Filter.h" | |
| 26 #include "../filter/RegExpFilter.h" | |
| 27 | |
| 28 class Matcher : public ref_counted | |
| 29 { | |
| 30 private: | |
| 31 Uint32Map<RegExpFilterPtr> mFilters; | |
| 32 std::vector<RegExpFilterPtr> mUnoptimizedFilters; | |
| 
sergei
2017/10/18 10:58:43
IMO, prefix Non would be better in comparison with
 | |
| 33 | |
| 34 public: | |
| 35 static Matcher* BINDINGS_EXPORTED Create(); | |
| 36 | |
| 37 void BINDINGS_EXPORTED Add(Filter& filter); | |
| 
sergei
2017/10/18 10:58:43
Since Matcher works only with RegExpFilter-based f
 | |
| 38 void BINDINGS_EXPORTED Remove(const Filter& filter); | |
| 39 RegExpFilter* BINDINGS_EXPORTED MatchesAny(const String& location, | |
| 40 int typeMask, DependentString& docDomain, bool thirdParty, | |
| 
sergei
2017/10/18 10:58:43
Just for reference, I see how docDomain is used in
 | |
| 41 const String& siteKey, bool specificOnly); | |
| 
Wladimir Palant
2017/10/17 12:51:22
Would be nice if this method could be const, it ca
 
sergei
2017/10/18 10:58:43
Yeah, since ref_counted is non-const it cannot be
 | |
| 42 }; | |
| OLD | NEW |