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

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

Issue 29556737: Issue 5141 - Convert filter match to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Cleanup. Fixed the bindings to export what we actually need. Created Sept. 27, 2017, 3:27 p.m.
Right Patch Set: Fixed many issues. One test left out. Created Oct. 6, 2017, 1:45 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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload) 126 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload)
127 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus) 127 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus)
128 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess) 128 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess)
129 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloada bleSubscription::SetErrorCount) 129 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloada bleSubscription::SetErrorCount)
130 .property("version", &DownloadableSubscription::GetDataRevision, &Downlo adableSubscription::SetDataRevision) 130 .property("version", &DownloadableSubscription::GetDataRevision, &Downlo adableSubscription::SetDataRevision)
131 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion) 131 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion)
132 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount) 132 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount)
133 .function("serialize", &DownloadableSubscription::Serialize); 133 .function("serialize", &DownloadableSubscription::Serialize);
134 134
135 class_<ReMatchResults>("ReMatchResults") 135 class_<ReMatchResults>("ReMatchResults")
136 .function("push", &ReMatchResults::push); 136 .function("push", &ReMatchResults::push);
Wladimir Palant 2017/10/09 08:39:47 Why do we need to export what is clearly an intern
sergei 2017/10/09 15:27:51 This class is used as a callback to obtain the res
hub 2017/10/10 13:46:15 The sole purpose of this class is to be able to ge
137 137
138 class_<CombinedMatcher>("CombinedMatcher")
139 .class_function("create", &CombinedMatcher::Create)
140 .function("add", &CombinedMatcher::Add)
141 .function("remove", &CombinedMatcher::Remove)
142 .function("matchesAny", &CombinedMatcher::MatchesAny)
143 .function("clear", &CombinedMatcher::Clear)
144 .function("hasFilter", &CombinedMatcher::HasFilter)
145 .function("getKeywordForFilter", &CombinedMatcher::GetKeywordForFilter)
146 .function("findKeyword", &CombinedMatcher::FindKeyword);
Wladimir Palant 2017/10/09 08:39:47 The three methods above shouldn't be exported, the
sergei 2017/10/09 15:27:52 I think they are currently exported for the sake o
Wladimir Palant 2017/10/10 07:39:05 Yes, that's probably it. We should remove/rewrite
hub 2017/10/10 13:46:15 Note that currently these are test that exist in m
147
138 class_<Matcher>("Matcher") 148 class_<Matcher>("Matcher")
149 .class_function("create", &Matcher::Create)
139 .function("add", &Matcher::Add) 150 .function("add", &Matcher::Add)
140 .function("remove", &Matcher::Remove) 151 .function("remove", &Matcher::Remove)
141 .function("matchesAny", &Matcher::MatchesAny) 152 .function("matchesAny", &Matcher::MatchesAny)
142 .function("clear", &Matcher::Clear) 153 .function("clear", &Matcher::Clear)
143 .function("hasFilter", &Matcher::HasFilter) 154 .function("hasFilter", &Matcher::HasFilter)
144 .function("getKeywordForFilter", &Matcher::GetKeywordForFilter); 155 .function("getKeywordForFilter", &Matcher::GetKeywordForFilter)
145 156 .function("findKeyword", &Matcher::FindKeyword);
146 singleton<MatcherBase>("defaultMatcher", &MatcherBase::GetDefaultInstance)
147 .function("add", &MatcherBase::Add)
148 .function("remove", &MatcherBase::Remove)
149 .function("matchesAny", &MatcherBase::MatchesAny)
150 .function("clear", &MatcherBase::Clear)
151 .function("hasFilter", &MatcherBase::HasFilter)
152 .function("getKeywordForFilter", &MatcherBase::GetKeywordForFilter);
153 157
154 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) 158 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
155 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) 159 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
156 .function("subscriptionAt", &FilterStorage::SubscriptionAt) 160 .function("subscriptionAt", &FilterStorage::SubscriptionAt)
157 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) 161 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
158 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 162 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
159 .function("addSubscription", &FilterStorage::AddSubscription) 163 .function("addSubscription", &FilterStorage::AddSubscription)
160 .function("removeSubscription", &FilterStorage::RemoveSubscription) 164 .function("removeSubscription", &FilterStorage::RemoveSubscription)
161 .function("moveSubscription", &FilterStorage::MoveSubscription); 165 .function("moveSubscription", &FilterStorage::MoveSubscription);
162 166
163 printBindings(); 167 printBindings();
164 RegExpFilter::GenerateCustomBindings(); 168 RegExpFilter::GenerateCustomBindings();
165 FilterNotifier::GenerateCustomBindings(); 169 FilterNotifier::GenerateCustomBindings();
166 170
167 return 0; 171 return 0;
168 } 172 }
169 catch (const std::exception& e) 173 catch (const std::exception& e)
170 { 174 {
171 EM_ASM_ARGS( 175 EM_ASM_ARGS(
172 console.error("Error occurred generating JavaScript bindings: " + 176 console.error("Error occurred generating JavaScript bindings: " +
173 Module.AsciiToString($0)), e.what() 177 Module.AsciiToString($0)), e.what()
174 ); 178 );
175 return 1; 179 return 1;
176 } 180 }
177 } 181 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld