Index: libadblockplus-android/jni/JniFilterEngine.cpp |
diff --git a/libadblockplus-android/jni/JniFilterEngine.cpp b/libadblockplus-android/jni/JniFilterEngine.cpp |
index 1f59aac630f338d3a92483dddde2b57cc2018b3f..7150cd5ceafc34c99e36e31458961342139e440e 100644 |
--- a/libadblockplus-android/jni/JniFilterEngine.cpp |
+++ b/libadblockplus-android/jni/JniFilterEngine.cpp |
@@ -65,6 +65,16 @@ static jboolean JNICALL JniIsFirstRun(JNIEnv* env, jclass clazz, jlong ptr) |
CATCH_THROW_AND_RETURN(env, JNI_FALSE); |
} |
+static jlong JNICALL JniGetFilterEnginePtr(JNIEnv* env, jclass clazz, jlong ptr) |
sergei
2017/09/26 09:44:13
It looks strange to have this method in this file
anton
2017/09/26 10:55:06
it's required to pass filter engine to c++ side fo
|
+{ |
+ try |
+ { |
+ AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); |
+ return (jlong)&engine; |
+ } |
+ CATCH_THROW_AND_RETURN(env, 0); |
+} |
+ |
static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstring jText) |
{ |
AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr); |
@@ -528,7 +538,8 @@ static JNINativeMethod methods[] = |
{ (char*)"setAcceptableAdsEnabled", (char*)"(JZ)V", (void*)JniSetAcceptableAdsEnabled }, |
{ (char*)"isAcceptableAdsEnabled", (char*)"(J)Z", (void*)JniIsAcceptableAdsEnabled }, |
{ (char*)"getAcceptableAdsSubscriptionURL", (char*)"(J)Ljava/lang/String;", (void*)JniGetAcceptableAdsSubscriptionURL }, |
- { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpdateFiltersAsync } |
+ { (char*)"updateFiltersAsync", (char*)"(JLjava/lang/String;)V", (void*)JniUpdateFiltersAsync }, |
+ { (char*)"getFilterEnginePtr", (char*)"(J)J", (void*)JniGetFilterEnginePtr }, |
}; |
extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngine_registerNatives(JNIEnv *env, jclass clazz) |