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

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

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: using method from c++ utils Created April 28, 2017, 10:44 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/JniJsEngine.cpp
diff --git a/libadblockplus-android/jni/JniJsEngine.cpp b/libadblockplus-android/jni/JniJsEngine.cpp
index d30cb3376830a5ea43fea013a4e6c4b08b58bea4..26ae5edde9232c9417fbf8334e98798f9a663c78 100644
--- a/libadblockplus-android/jni/JniJsEngine.cpp
+++ b/libadblockplus-android/jni/JniJsEngine.cpp
@@ -136,6 +136,19 @@ static void JNICALL JniSetDefaultFileSystem(JNIEnv* env, jclass clazz, jlong ptr
CATCH_AND_THROW(env)
}
+static void JNICALL JniSetFileSystem(JNIEnv* env, jclass clazz, jlong ptr, jlong fileSystemPtr)
+{
+ AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
+
+ try
+ {
+ AdblockPlus::FileSystemPtr fileSystem(JniLongToTypePtr<JniFileSystemCallback>(fileSystemPtr));
sergei 2017/05/22 12:09:07 This will result in double deletion because JniFil
anton 2017/05/22 13:04:38 Acknowledged.
+
+ engine->SetFileSystem(fileSystem);
+ }
+ CATCH_AND_THROW(env)
+}
+
static void JNICALL JniSetDefaultWebRequest(JNIEnv* env, jclass clazz, jlong ptr)
{
AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
@@ -242,6 +255,7 @@ static JNINativeMethod methods[] =
{ (char*)"evaluate", (char*)"(JLjava/lang/String;Ljava/lang/String;)" TYP("JsValue"), (void*)JniEvaluate },
+ { (char*)"setFileSystem", (char*)"(JJ)V", (void*)JniSetFileSystem },
{ (char*)"setDefaultFileSystem", (char*)"(JLjava/lang/String;)V", (void*)JniSetDefaultFileSystem },
{ (char*)"setLogSystem", (char*)"(JJ)V", (void*)JniSetLogSystem },
{ (char*)"setDefaultLogSystem", (char*)"(J)V", (void*)JniSetDefaultLogSystem },

Powered by Google App Engine
This is Rietveld