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

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

Issue 29587914: Issue 5142 - Convert Element Hiding to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Oct. 25, 2017, 1:07 a.m.
Right Patch Set: mFiltersByDomain is now an OwnedStringMap Created Jan. 26, 2018, 8:41 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/ElemHide.cpp ('k') | compiled/filter/ActiveFilter.h » ('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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi t) 68 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi t)
69 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) 69 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain)
70 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) 70 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain)
71 .function("isGeneric", &ActiveFilter::IsGeneric) 71 .function("isGeneric", &ActiveFilter::IsGeneric)
72 .function("serialize", &ActiveFilter::Serialize); 72 .function("serialize", &ActiveFilter::Serialize);
73 73
74 class_<RegExpFilter,ActiveFilter>("RegExpFilter") 74 class_<RegExpFilter,ActiveFilter>("RegExpFilter")
75 .function("matches", &RegExpFilter::Matches); 75 .function("matches", &RegExpFilter::Matches);
76 76
77 class_<BlockingFilter,RegExpFilter>("BlockingFilter") 77 class_<BlockingFilter,RegExpFilter>("BlockingFilter")
78 .class_property("type", "'blocking'"); 78 .class_property("type", "'blocking'")
79 .property("collapse", &BlockingFilter::GetCollapse);
80
79 81
80 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") 82 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter")
81 .class_property("type", "'whitelist'"); 83 .class_property("type", "'whitelist'");
82 84
83 class_<ElemHideBase,ActiveFilter>("ElemHideBase") 85 class_<ElemHideBase,ActiveFilter>("ElemHideBase")
84 .property("selector", &ElemHideBase::GetSelector) 86 .property("selector", &ElemHideBase::GetSelector)
85 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); 87 .property("selectorDomain", &ElemHideBase::GetSelectorDomain);
86 88
87 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") 89 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter")
88 .class_property("type", "'elemhide'"); 90 .class_property("type", "'elemhide'");
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 136
135 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) 137 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
136 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) 138 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
137 .function("subscriptionAt", &FilterStorage::SubscriptionAt) 139 .function("subscriptionAt", &FilterStorage::SubscriptionAt)
138 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) 140 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
139 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 141 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
140 .function("addSubscription", &FilterStorage::AddSubscription) 142 .function("addSubscription", &FilterStorage::AddSubscription)
141 .function("removeSubscription", &FilterStorage::RemoveSubscription) 143 .function("removeSubscription", &FilterStorage::RemoveSubscription)
142 .function("moveSubscription", &FilterStorage::MoveSubscription); 144 .function("moveSubscription", &FilterStorage::MoveSubscription);
143 145
144 class_<_ElemHide_SelectorList>("_ElemHide_SelectorList") 146 class_<ElemHide_SelectorList>("ElemHide_SelectorList")
145 .property("selectorCount", &_ElemHide_SelectorList::GetSelectorCount) 147 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount)
146 .function("selectorAt", &_ElemHide_SelectorList::SelectorAt) 148 .function("selectorAt", &ElemHide_SelectorList::SelectorAt)
147 .function("filterKeyAt", &_ElemHide_SelectorList::FilterKeyAt); 149 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt);
148 150
149 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) 151 class_<ElemHide>("ElemHide")
152 .class_function("create", &ElemHide::Create)
150 .function("add", &ElemHide::Add) 153 .function("add", &ElemHide::Add)
151 .function("remove", &ElemHide::Remove) 154 .function("remove", &ElemHide::Remove)
152 .function("clear", &ElemHide::Clear) 155 .function("clear", &ElemHide::Clear)
153 .function("getException", &ElemHide::GetException) 156 .function("getException", &ElemHide::GetException)
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 printBindings(); 160 printBindings();
158 RegExpFilter::GenerateCustomBindings(); 161 RegExpFilter::GenerateCustomBindings();
159 FilterNotifier::GenerateCustomBindings(); 162 FilterNotifier::GenerateCustomBindings();
160 163
161 return 0; 164 return 0;
162 } 165 }
163 catch (const std::exception& e) 166 catch (const std::exception& e)
164 { 167 {
165 EM_ASM_ARGS( 168 EM_ASM_ARGS(
166 console.error("Error occurred generating JavaScript bindings: " + 169 console.error("Error occurred generating JavaScript bindings: " +
167 Module.AsciiToString($0)), e.what() 170 Module.AsciiToString($0)), e.what()
168 ); 171 );
169 return 1; 172 return 1;
170 } 173 }
171 } 174 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld