| LEFT | RIGHT |
| (no file at all) | |
| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 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 } | |
| 182 | |
| 183 namespace | |
| 184 { | |
| 185 class Sync | |
| 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 } | 181 } |
| 213 | 182 |
| 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) |
| (...skipping 414 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 } |
| LEFT | RIGHT |