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: Created Sept. 26, 2017, 9:34 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 singleton<MatcherBase>("Matcher", &MatcherBase::GetDefaultInstance) 138 class_<CombinedMatcher>("CombinedMatcher")
139 .function("add", &MatcherBase::Add) 139 .class_function("create", &CombinedMatcher::Create)
140 .function("remove", &MatcherBase::Remove) 140 .function("add", &CombinedMatcher::Add)
141 .function("matchesAny", &MatcherBase::MatchesAny) 141 .function("remove", &CombinedMatcher::Remove)
142 .function("clear", &MatcherBase::Clear) 142 .function("matchesAny", &CombinedMatcher::MatchesAny)
143 .function("hasFilter", &MatcherBase::HasFilter) 143 .function("clear", &CombinedMatcher::Clear)
144 .function("getKeywordForFilter", &MatcherBase::GetKeywordForFilter); 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
148 class_<Matcher>("Matcher")
149 .class_function("create", &Matcher::Create)
150 .function("add", &Matcher::Add)
151 .function("remove", &Matcher::Remove)
152 .function("matchesAny", &Matcher::MatchesAny)
153 .function("clear", &Matcher::Clear)
154 .function("hasFilter", &Matcher::HasFilter)
155 .function("getKeywordForFilter", &Matcher::GetKeywordForFilter)
156 .function("findKeyword", &Matcher::FindKeyword);
145 157
146 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) 158 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
147 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) 159 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
148 .function("subscriptionAt", &FilterStorage::SubscriptionAt) 160 .function("subscriptionAt", &FilterStorage::SubscriptionAt)
149 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) 161 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
150 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 162 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
151 .function("addSubscription", &FilterStorage::AddSubscription) 163 .function("addSubscription", &FilterStorage::AddSubscription)
152 .function("removeSubscription", &FilterStorage::RemoveSubscription) 164 .function("removeSubscription", &FilterStorage::RemoveSubscription)
153 .function("moveSubscription", &FilterStorage::MoveSubscription); 165 .function("moveSubscription", &FilterStorage::MoveSubscription);
154 166
155 printBindings(); 167 printBindings();
156 RegExpFilter::GenerateCustomBindings(); 168 RegExpFilter::GenerateCustomBindings();
157 FilterNotifier::GenerateCustomBindings(); 169 FilterNotifier::GenerateCustomBindings();
158 170
159 return 0; 171 return 0;
160 } 172 }
161 catch (const std::exception& e) 173 catch (const std::exception& e)
162 { 174 {
163 EM_ASM_ARGS( 175 EM_ASM_ARGS(
164 console.error("Error occurred generating JavaScript bindings: " + 176 console.error("Error occurred generating JavaScript bindings: " +
165 Module.AsciiToString($0)), e.what() 177 Module.AsciiToString($0)), e.what()
166 ); 178 );
167 return 1; 179 return 1;
168 } 180 }
169 } 181 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld