Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: compiled/bindings/main.cpp

Issue 29594607: Issue 5143 - Convert ElemHideEmulation to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Rebased. Created Dec. 5, 2017, 6:03 p.m.
Right Patch Set: Review comments addressed Created Jan. 30, 2018, 5:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/ElemHideEmulation.cpp ('k') | lib/elemHideEmulation.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 142 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
143 .function("addSubscription", &FilterStorage::AddSubscription) 143 .function("addSubscription", &FilterStorage::AddSubscription)
144 .function("removeSubscription", &FilterStorage::RemoveSubscription) 144 .function("removeSubscription", &FilterStorage::RemoveSubscription)
145 .function("moveSubscription", &FilterStorage::MoveSubscription); 145 .function("moveSubscription", &FilterStorage::MoveSubscription);
146 146
147 class_<ElemHide_SelectorList>("ElemHide_SelectorList") 147 class_<ElemHide_SelectorList>("ElemHide_SelectorList")
148 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) 148 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount)
149 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) 149 .function("selectorAt", &ElemHide_SelectorList::SelectorAt)
150 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); 150 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt);
151 151
152 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) 152 class_<ElemHide>("ElemHide")
153 .class_function("create", &ElemHide::Create)
153 .function("add", &ElemHide::Add) 154 .function("add", &ElemHide::Add)
154 .function("remove", &ElemHide::Remove) 155 .function("remove", &ElemHide::Remove)
155 .function("clear", &ElemHide::Clear) 156 .function("clear", &ElemHide::Clear)
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 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") 160 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList")
160 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) 161 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount)
161 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); 162 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt);
162 163
163 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns tance) 164 class_<ElemHideEmulation>("ElemHideEmulation")
165 .class_function("create", &ElemHideEmulation::Create)
164 .function("add", &ElemHideEmulation::Add) 166 .function("add", &ElemHideEmulation::Add)
165 .function("remove", &ElemHideEmulation::Remove) 167 .function("remove", &ElemHideEmulation::Remove)
166 .function("clear", &ElemHideEmulation::Clear) 168 .function("clear", &ElemHideEmulation::Clear)
167 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); 169 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain);
168 170
169 printBindings(); 171 printBindings();
170 RegExpFilter::GenerateCustomBindings(); 172 RegExpFilter::GenerateCustomBindings();
171 FilterNotifier::GenerateCustomBindings(); 173 FilterNotifier::GenerateCustomBindings();
172 174
173 return 0; 175 return 0;
174 } 176 }
175 catch (const std::exception& e) 177 catch (const std::exception& e)
176 { 178 {
177 EM_ASM_ARGS( 179 EM_ASM_ARGS(
178 console.error("Error occurred generating JavaScript bindings: " + 180 console.error("Error occurred generating JavaScript bindings: " +
179 Module.AsciiToString($0)), e.what() 181 Module.AsciiToString($0)), e.what()
180 ); 182 );
181 return 1; 183 return 1;
182 } 184 }
183 } 185 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld