| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 *JniLocalReference<jstring>(env, | 365 *JniLocalReference<jstring>(env, |
| 366 static_cast<jstring>( | 366 static_cast<jstring>( |
| 367 env->GetObjectArrayElement(jArray, i))))); | 367 env->GetObjectArrayElement(jArray, i))))); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, | 372 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, |
| 373 jstring jUrl, jobject jContentType, jobjectArray jDocumentUrls) | 373 jstring jUrl, jobject jContentType, jobjectArray jDocumentUrls) |
| 374 { | 374 { |
| 375 AdblockPlus::FilterEnginePtr& engine = | 375 AdblockPlus::FilterEnginePtr& engine = GetFilterEnginePtrRef(ptr); |
| 376 GetFilterEnginePtrRef(ptr); | |
| 377 | 376 |
| 378 std::string url = JniJavaToStdString(env, jUrl); | 377 std::string url = JniJavaToStdString(env, jUrl); |
| 379 AdblockPlus::FilterEngine::ContentType contentType = | 378 AdblockPlus::FilterEngine::ContentType contentType = |
| 380 ConvertContentType(env, jContentType); | 379 ConvertContentType(env, jContentType); |
| 381 | 380 |
| 382 std::vector<std::string> documentUrls; | 381 std::vector<std::string> documentUrls; |
| 383 JavaStringArrayToStringVector(env, jDocumentUrls, documentUrls); | 382 JavaStringArrayToStringVector(env, jDocumentUrls, documentUrls); |
| 384 | 383 |
| 385 try | 384 try |
| 386 { | 385 { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 } | 534 } |
| 536 | 535 |
| 537 static void JNICALL JniUpdateFiltersAsync(JNIEnv* env, jclass clazz, jlong ptr, jstring jSubscriptionUrl) | 536 static void JNICALL JniUpdateFiltersAsync(JNIEnv* env, jclass clazz, jlong ptr, jstring jSubscriptionUrl) |
| 538 { | 537 { |
| 539 std::string subscriptionUrl = JniJavaToStdString(env, jSubscriptionUrl); | 538 std::string subscriptionUrl = JniJavaToStdString(env, jSubscriptionUrl); |
| 540 auto jniFilterEngine = JniLongToTypePtr<JniFilterEngine>(ptr); | 539 auto jniFilterEngine = JniLongToTypePtr<JniFilterEngine>(ptr); |
| 541 std::weak_ptr<AdblockPlus::FilterEngine> weakFilterEngine = jniFilterEngine->f ilterEngine; | 540 std::weak_ptr<AdblockPlus::FilterEngine> weakFilterEngine = jniFilterEngine->f ilterEngine; |
| 542 jniFilterEngine->timer->SetTimer(std::chrono::milliseconds(0), [weakFilterEngi ne, subscriptionUrl] | 541 jniFilterEngine->timer->SetTimer(std::chrono::milliseconds(0), [weakFilterEngi ne, subscriptionUrl] |
| 543 { | 542 { |
| 544 auto filterEngine = weakFilterEngine.lock(); | 543 auto filterEngine = weakFilterEngine.lock(); |
| 545 if (!filterEngine) | 544 if (!filterEngine) |
|
anton
2017/06/15 05:51:53
"{" required here
sergei
2017/06/16 11:12:08
Done.
| |
| 545 { | |
| 546 return; | 546 return; |
| 547 } | |
| 547 for (auto& subscription : filterEngine->GetListedSubscriptions()) | 548 for (auto& subscription : filterEngine->GetListedSubscriptions()) |
|
anton
2017/06/15 05:51:53
"}" required here
sergei
2017/06/16 11:12:08
Done.
| |
| 548 { | 549 { |
| 549 if (stringBeginsWith(subscriptionUrl, subscription.GetProperty("url").AsSt ring())) | 550 if (stringBeginsWith(subscriptionUrl, subscription.GetProperty("url").AsSt ring())) |
| 550 { | 551 { |
| 551 subscription.UpdateFilters(); | 552 subscription.UpdateFilters(); |
| 552 return; | 553 return; |
| 553 } | 554 } |
| 554 } | 555 } |
| 555 }); | 556 }); |
| 556 } | 557 } |
| 557 | 558 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 586 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna bled }, | 587 { (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEna bled }, |
| 587 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v oid*)JniGetAcceptableAdsSubscriptionURL }, | 588 { (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (v oid*)JniGetAcceptableAdsSubscriptionURL }, |
| 588 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, | 589 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, |
| 589 { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpda teFiltersAsync } | 590 { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpda teFiltersAsync } |
| 590 }; | 591 }; |
| 591 | 592 |
| 592 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz) | 593 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz) |
| 593 { | 594 { |
| 594 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 595 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
| 595 } | 596 } |
| LEFT | RIGHT |