Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 if (isAllowedConnectionCallbackPtr != 0) | 55 if (isAllowedConnectionCallbackPtr != 0) |
56 { | 56 { |
57 AdblockPlus::FilterEngine::CreationParameters creationParameters; | 57 AdblockPlus::FilterEngine::CreationParameters creationParameters; |
58 JniIsAllowedConnectionTypeCallback* callback = | 58 JniIsAllowedConnectionTypeCallback* callback = |
59 JniLongToTypePtr<JniIsAllowedConnectionTypeCallback>(isAllowedConnection CallbackPtr); | 59 JniLongToTypePtr<JniIsAllowedConnectionTypeCallback>(isAllowedConnection CallbackPtr); |
60 | 60 |
61 creationParameters.isSubscriptionDowloadAllowedCallback = | 61 creationParameters.isSubscriptionDowloadAllowedCallback = |
62 [callback](const std::string* allowedConnectionTypeArg, const std::funct ion<void(bool)>& doneCallback) | 62 [callback](const std::string* allowedConnectionTypeArg, const std::funct ion<void(bool)>& doneCallback) |
63 { | 63 { |
64 std::shared_ptr<std::string> allowedConnectionType; | 64 std::shared_ptr<std::string> allowedConnectionType; |
65 if (allowedConnectionTypeArg) | 65 if (allowedConnectionTypeArg) |
anton
2017/06/02 06:55:23
"{" required
sergei
2017/06/02 07:32:43
Done.
| |
66 { | |
66 allowedConnectionType = std::make_shared<std::string>(*allowedConnecti onTypeArg); | 67 allowedConnectionType = std::make_shared<std::string>(*allowedConnecti onTypeArg); |
68 } | |
67 std::thread([callback, allowedConnectionType, doneCallback] | 69 std::thread([callback, allowedConnectionType, doneCallback] |
sergei
2017/06/01 14:41:57
Detached thread is still a hack with data race, ba
anton
2017/06/02 06:55:23
"}" required
sergei
2017/06/02 07:32:43
Done.
| |
68 { | 70 { |
69 doneCallback(callback->Callback(allowedConnectionType.get())); | 71 doneCallback(callback->Callback(allowedConnectionType.get())); |
70 }).detach(); | 72 }).detach(); |
71 }; | 73 }; |
72 | 74 |
73 filterEngine = new AdblockPlus::FilterEnginePtr( | 75 filterEngine = new AdblockPlus::FilterEnginePtr( |
74 AdblockPlus::FilterEngine::Create(jsEngine, creationParameters)); | 76 AdblockPlus::FilterEngine::Create(jsEngine, creationParameters)); |
75 } | 77 } |
76 else | 78 else |
77 { | 79 { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds Enabled }, | 556 { (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAds Enabled }, |
555 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna bled }, | 557 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna bled }, |
556 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v oid*)JniGetAcceptableAdsSubscriptionURL }, | 558 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v oid*)JniGetAcceptableAdsSubscriptionURL }, |
557 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 559 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
558 }; | 560 }; |
559 | 561 |
560 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz) | 562 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz) |
561 { | 563 { |
562 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 564 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
563 } | 565 } |
LEFT | RIGHT |