Left: | ||
Right: |
OLD | NEW |
---|---|
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 bool Subscription::IsAA() const | 173 bool Subscription::IsAA() const |
174 { | 174 { |
175 return jsEngine->Evaluate("API.isAASubscription").Call(*this).AsBool(); | 175 return jsEngine->Evaluate("API.isAASubscription").Call(*this).AsBool(); |
176 } | 176 } |
177 | 177 |
178 bool Subscription::operator==(const Subscription& subscription) const | 178 bool Subscription::operator==(const Subscription& subscription) const |
179 { | 179 { |
180 return GetProperty("url").AsString() == subscription.GetProperty("url").AsStri ng(); | 180 return GetProperty("url").AsString() == subscription.GetProperty("url").AsStri ng(); |
181 } | 181 } |
182 | 182 |
183 namespace | |
184 { | |
185 class Sync | |
sergei
2017/07/05 10:03:21
A minor thing, but do you mind to make this change
hub
2017/07/06 12:21:52
this require some patch surgery to make it worth i
| |
186 { | |
187 public: | |
188 Sync() | |
189 :initialized(false) | |
190 { | |
191 | |
192 } | |
193 void Wait() | |
194 { | |
195 std::unique_lock<std::mutex> lock(mutex); | |
196 while (!initialized) | |
197 cv.wait(lock); | |
198 } | |
199 void Set() | |
200 { | |
201 { | |
202 std::unique_lock<std::mutex> lock(mutex); | |
203 initialized = true; | |
204 } | |
205 cv.notify_all(); | |
206 } | |
207 private: | |
208 std::mutex mutex; | |
209 std::condition_variable cv; | |
210 bool initialized; | |
211 }; | |
212 } | |
213 | |
214 FilterEngine::FilterEngine(const JsEnginePtr& jsEngine) | 183 FilterEngine::FilterEngine(const JsEnginePtr& jsEngine) |
215 : jsEngine(jsEngine), firstRun(false), updateCheckId(0) | 184 : jsEngine(jsEngine), firstRun(false), updateCheckId(0) |
216 { | 185 { |
217 } | 186 } |
218 | 187 |
219 void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine, | 188 void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine, |
220 const FilterEngine::OnCreatedCallback& onCreated, | 189 const FilterEngine::OnCreatedCallback& onCreated, |
221 const FilterEngine::CreationParameters& params) | 190 const FilterEngine::CreationParameters& params) |
222 { | 191 { |
223 FilterEnginePtr filterEngine(new FilterEngine(jsEngine)); | 192 FilterEnginePtr filterEngine(new FilterEngine(jsEngine)); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); | 605 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); |
637 if (filter) | 606 if (filter) |
638 { | 607 { |
639 return filter; | 608 return filter; |
640 } | 609 } |
641 currentUrl = parentUrl; | 610 currentUrl = parentUrl; |
642 } | 611 } |
643 while (urlIterator != documentUrls.end()); | 612 while (urlIterator != documentUrls.end()); |
644 return FilterPtr(); | 613 return FilterPtr(); |
645 } | 614 } |
OLD | NEW |