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

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

Issue 29533572: Issue 5556 - Update to use libadblockplus revision hg:566f64c8a2a8 (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: Created Sept. 1, 2017, 9:41 a.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
Index: libadblockplus-android/jni/JniFilterEngine.cpp
diff --git a/libadblockplus-android/jni/JniFilterEngine.cpp b/libadblockplus-android/jni/JniFilterEngine.cpp
index 97fb01ddee81fde4a11e238fd0f793d64f9a2ff3..3f6c0d4870391cabf213397131cf11c53a34153c 100644
--- a/libadblockplus-android/jni/JniFilterEngine.cpp
+++ b/libadblockplus-android/jni/JniFilterEngine.cpp
@@ -60,7 +60,7 @@ namespace
}
}
-static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jniJsEnginePtr, jlong isAllowedConnectionCallbackPtr)
+static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jniJsEnginePtr, jobject jIsSubscriptionDownloadAllowedCallback)
{
try
{
@@ -69,11 +69,10 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jniJsEnginePtr, jl
auto jniFilterEngine = new JniFilterEngine();
jniFilterEngine->timer = jniJsEngine->timer;
- if (isAllowedConnectionCallbackPtr != 0)
+ if (jIsSubscriptionDownloadAllowedCallback)
{
AdblockPlus::FilterEngine::CreationParameters creationParameters;
- JniIsAllowedConnectionTypeCallback* callback =
- JniLongToTypePtr<JniIsAllowedConnectionTypeCallback>(isAllowedConnectionCallbackPtr);
+ auto callback = std::make_shared<JniIsAllowedConnectionTypeCallback>(env, jIsSubscriptionDownloadAllowedCallback);
creationParameters.isSubscriptionDownloadAllowedCallback =
[callback](const std::string* allowedConnectionTypeArg, const std::function<void(bool)>& doneCallback)
@@ -553,7 +552,7 @@ static void JNICALL JniUpdateFiltersAsync(JNIEnv* env, jclass clazz, jlong ptr,
static JNINativeMethod methods[] =
{
- { (char*)"ctor", (char*)"(JJ)J", (void*)JniCtor },
+ { (char*)"ctor", (char*)"(J" TYP("IsAllowedConnectionCallback") ")J", (void*)JniCtor },
{ (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun },
{ (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)JniGetFilter },
{ (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListedFilters },

Powered by Google App Engine
This is Rietveld