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: Improvements from review. Created Nov. 20, 2017, 7:15 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi t) 69 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi t)
70 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) 70 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain)
71 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) 71 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain)
72 .function("isGeneric", &ActiveFilter::IsGeneric) 72 .function("isGeneric", &ActiveFilter::IsGeneric)
73 .function("serialize", &ActiveFilter::Serialize); 73 .function("serialize", &ActiveFilter::Serialize);
74 74
75 class_<RegExpFilter,ActiveFilter>("RegExpFilter") 75 class_<RegExpFilter,ActiveFilter>("RegExpFilter")
76 .function("matches", &RegExpFilter::Matches); 76 .function("matches", &RegExpFilter::Matches);
77 77
78 class_<BlockingFilter,RegExpFilter>("BlockingFilter") 78 class_<BlockingFilter,RegExpFilter>("BlockingFilter")
79 .class_property("type", "'blocking'"); 79 .class_property("type", "'blocking'")
80 .property("collapse", &BlockingFilter::GetCollapse);
81
80 82
81 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") 83 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter")
82 .class_property("type", "'whitelist'"); 84 .class_property("type", "'whitelist'");
83 85
84 class_<ElemHideBase,ActiveFilter>("ElemHideBase") 86 class_<ElemHideBase,ActiveFilter>("ElemHideBase")
85 .property("selector", &ElemHideBase::GetSelector) 87 .property("selector", &ElemHideBase::GetSelector)
86 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); 88 .property("selectorDomain", &ElemHideBase::GetSelectorDomain);
87 89
88 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") 90 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter")
89 .class_property("type", "'elemhide'"); 91 .class_property("type", "'elemhide'");
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 137
136 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) 138 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
137 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) 139 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
138 .function("subscriptionAt", &FilterStorage::SubscriptionAt) 140 .function("subscriptionAt", &FilterStorage::SubscriptionAt)
139 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) 141 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
140 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 142 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
141 .function("addSubscription", &FilterStorage::AddSubscription) 143 .function("addSubscription", &FilterStorage::AddSubscription)
142 .function("removeSubscription", &FilterStorage::RemoveSubscription) 144 .function("removeSubscription", &FilterStorage::RemoveSubscription)
143 .function("moveSubscription", &FilterStorage::MoveSubscription); 145 .function("moveSubscription", &FilterStorage::MoveSubscription);
144 146
145 class_<_ElemHide_SelectorList>("_ElemHide_SelectorList") 147 class_<ElemHide_SelectorList>("ElemHide_SelectorList")
146 .property("selectorCount", &_ElemHide_SelectorList::GetSelectorCount) 148 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount)
147 .function("selectorAt", &_ElemHide_SelectorList::SelectorAt) 149 .function("selectorAt", &ElemHide_SelectorList::SelectorAt)
148 .function("filterKeyAt", &_ElemHide_SelectorList::FilterKeyAt); 150 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt);
149 151
150 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) 152 class_<ElemHide>("ElemHide")
153 .class_function("create", &ElemHide::Create)
151 .function("add", &ElemHide::Add) 154 .function("add", &ElemHide::Add)
152 .function("remove", &ElemHide::Remove) 155 .function("remove", &ElemHide::Remove)
153 .function("clear", &ElemHide::Clear) 156 .function("clear", &ElemHide::Clear)
154 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) 157 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain)
155 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); 158 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors);
156 159
157 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") 160 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList")
158 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) 161 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount)
159 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); 162 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt);
160 163
161 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns tance) 164 class_<ElemHideEmulation>("ElemHideEmulation")
165 .class_function("create", &ElemHideEmulation::Create)
162 .function("add", &ElemHideEmulation::Add) 166 .function("add", &ElemHideEmulation::Add)
163 .function("remove", &ElemHideEmulation::Remove) 167 .function("remove", &ElemHideEmulation::Remove)
164 .function("clear", &ElemHideEmulation::Clear) 168 .function("clear", &ElemHideEmulation::Clear)
165 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); 169 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain);
166 170
167 printBindings(); 171 printBindings();
168 RegExpFilter::GenerateCustomBindings(); 172 RegExpFilter::GenerateCustomBindings();
169 FilterNotifier::GenerateCustomBindings(); 173 FilterNotifier::GenerateCustomBindings();
170 174
171 return 0; 175 return 0;
172 } 176 }
173 catch (const std::exception& e) 177 catch (const std::exception& e)
174 { 178 {
175 EM_ASM_ARGS( 179 EM_ASM_ARGS(
176 console.error("Error occurred generating JavaScript bindings: " + 180 console.error("Error occurred generating JavaScript bindings: " +
177 Module.AsciiToString($0)), e.what() 181 Module.AsciiToString($0)), e.what()
178 ); 182 );
179 return 1; 183 return 1;
180 } 184 }
181 } 185 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld