 Issue 29587914:
  Issue 5142 - Convert Element Hiding to C++  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/
    
  
    Issue 29587914:
  Issue 5142 - Convert Element Hiding to C++  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/| Left: | ||
| Right: | 
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) | 141 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) | 
| 142 .function("addSubscription", &FilterStorage::AddSubscription) | 142 .function("addSubscription", &FilterStorage::AddSubscription) | 
| 143 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 143 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 
| 144 .function("moveSubscription", &FilterStorage::MoveSubscription); | 144 .function("moveSubscription", &FilterStorage::MoveSubscription); | 
| 145 | 145 | 
| 146 class_<ElemHide_SelectorList>("ElemHide_SelectorList") | 146 class_<ElemHide_SelectorList>("ElemHide_SelectorList") | 
| 147 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) | 147 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) | 
| 148 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) | 148 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) | 
| 149 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); | 149 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); | 
| 150 | 150 | 
| 151 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) | 151 class_<ElemHide>("ElemHide") | 
| 
sergei
2018/01/15 15:31:19
Could you please change it from singleton to a cla
 
hub
2018/01/16 02:57:39
I can. 
This require a few other changes, ElemHid
 | |
| 152 .class_function("create", &ElemHide::Create) | |
| 152 .function("add", &ElemHide::Add) | 153 .function("add", &ElemHide::Add) | 
| 153 .function("remove", &ElemHide::Remove) | 154 .function("remove", &ElemHide::Remove) | 
| 154 .function("clear", &ElemHide::Clear) | 155 .function("clear", &ElemHide::Clear) | 
| 155 .function("getException", &ElemHide::GetException) | 156 .function("getException", &ElemHide::GetException) | 
| 156 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) | 157 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) | 
| 157 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); | 158 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); | 
| 158 | 159 | 
| 159 printBindings(); | 160 printBindings(); | 
| 160 RegExpFilter::GenerateCustomBindings(); | 161 RegExpFilter::GenerateCustomBindings(); | 
| 161 FilterNotifier::GenerateCustomBindings(); | 162 FilterNotifier::GenerateCustomBindings(); | 
| 162 | 163 | 
| 163 return 0; | 164 return 0; | 
| 164 } | 165 } | 
| 165 catch (const std::exception& e) | 166 catch (const std::exception& e) | 
| 166 { | 167 { | 
| 167 EM_ASM_ARGS( | 168 EM_ASM_ARGS( | 
| 168 console.error("Error occurred generating JavaScript bindings: " + | 169 console.error("Error occurred generating JavaScript bindings: " + | 
| 169 Module.AsciiToString($0)), e.what() | 170 Module.AsciiToString($0)), e.what() | 
| 170 ); | 171 ); | 
| 171 return 1; | 172 return 1; | 
| 172 } | 173 } | 
| 173 } | 174 } | 
| LEFT | RIGHT |