Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/jni/JniFilterEngine.cpp

Issue 29453616: Issue 5286 - Update to use libadblockplus rev. b88d098aeab5 (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: add missed dependencies Created June 2, 2017, 1:45 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dependencies ('k') | libadblockplus-android/jni/JniJsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libadblockplus-android/jni/JniFilterEngine.cpp
diff --git a/libadblockplus-android/jni/JniFilterEngine.cpp b/libadblockplus-android/jni/JniFilterEngine.cpp
index 25a9225af081c12b32ab78ea2864273d449b65b2..c70ec4cbb08aee084140909eef0b7c91427323ae 100644
--- a/libadblockplus-android/jni/JniFilterEngine.cpp
+++ b/libadblockplus-android/jni/JniFilterEngine.cpp
@@ -18,6 +18,7 @@
#include <AdblockPlus.h>
#include "Utils.h"
#include "JniCallbacks.h"
+#include <thread>
static jobject SubscriptionsToArrayList(JNIEnv* env, std::vector<AdblockPlus::Subscription>&& subscriptions)
{
@@ -57,9 +58,19 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsEnginePtr, jlong
JniIsAllowedConnectionTypeCallback* callback =
JniLongToTypePtr<JniIsAllowedConnectionTypeCallback>(isAllowedConnectionCallbackPtr);
- AdblockPlus::FilterEngine::IsConnectionAllowedCallback cppCallback =
- std::bind(&JniIsAllowedConnectionTypeCallback::Callback, callback, std::placeholders::_1);
- creationParameters.isConnectionAllowedCallback = cppCallback;
+ creationParameters.isSubscriptionDowloadAllowedCallback =
+ [callback](const std::string* allowedConnectionTypeArg, const std::function<void(bool)>& doneCallback)
+ {
+ std::shared_ptr<std::string> allowedConnectionType;
+ if (allowedConnectionTypeArg)
+ {
+ allowedConnectionType = std::make_shared<std::string>(*allowedConnectionTypeArg);
+ }
+ std::thread([callback, allowedConnectionType, doneCallback]
+ {
+ doneCallback(callback->Callback(allowedConnectionType.get()));
+ }).detach();
+ };
filterEngine = new AdblockPlus::FilterEnginePtr(
AdblockPlus::FilterEngine::Create(jsEngine, creationParameters));
« no previous file with comments | « dependencies ('k') | libadblockplus-android/jni/JniJsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld