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

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

Issue 29524565: Issue 5556 - remove LogSystem setters (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: Created Aug. 23, 2017, 11:49 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 0d3ed5dcd5e6f2fe1ebfb86e991c7cdba5f99c07..a6cc59512a8eec674b98e7f4276cdc233101682c 100644
--- a/libadblockplus-android/jni/JniJsEngine.cpp
+++ b/libadblockplus-android/jni/JniJsEngine.cpp
@@ -39,7 +39,7 @@ static AdblockPlus::JsEngine& GetJsEngineRef(jlong ptr)
return *JniLongToTypePtr<JniJsEngine>(ptr)->jsEngine;
}
-static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo)
+static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo, jlong logSystemPtr)
{
AdblockPlus::AppInfo appInfo;
@@ -51,6 +51,10 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo)
JniJsEngine* jniJsEngine = new JniJsEngine();
jniJsEngine->timer = timer.get();
jniJsEngine->jsEngine = AdblockPlus::JsEngine::New(appInfo, std::move(timer));
+ if (logSystemPtr)
+ {
+ jniJsEngine->jsEngine->SetLogSystem(*JniLongToTypePtr<AdblockPlus::LogSystemPtr>(logSystemPtr));
+ }
return JniPtrToLong(jniJsEngine);
}
CATCH_THROW_AND_RETURN(env, 0)
@@ -150,32 +154,6 @@ static void JNICALL JniSetDefaultFileSystem(JNIEnv* env, jclass clazz, jlong ptr
CATCH_AND_THROW(env)
}
-static void JNICALL JniSetDefaultLogSystem(JNIEnv* env, jclass clazz, jlong ptr)
-{
- AdblockPlus::JsEngine& engine = GetJsEngineRef(ptr);
-
- try
- {
- AdblockPlus::LogSystemPtr logSystem(new AdblockPlus::DefaultLogSystem());
-
- engine.SetLogSystem(logSystem);
- }
- CATCH_AND_THROW(env)
-}
-
-static void JNICALL JniSetLogSystem(JNIEnv* env, jclass clazz, jlong ptr, jlong logSystemPtr)
-{
- AdblockPlus::JsEngine& engine = GetJsEngineRef(ptr);
-
- try
- {
- AdblockPlus::LogSystemPtr logSystem = *JniLongToTypePtr<AdblockPlus::LogSystemPtr>(logSystemPtr);
-
- engine.SetLogSystem(logSystem);
- }
- CATCH_AND_THROW(env)
-}
-
static void JNICALL JniSetWebRequest(JNIEnv* env, jclass clazz, jlong ptr, jlong webRequestPtr)
{
AdblockPlus::JsEngine& engine = GetJsEngineRef(ptr);
@@ -231,7 +209,7 @@ static jobject JNICALL JniNewStringValue(JNIEnv* env, jclass clazz, jlong ptr, j
static JNINativeMethod methods[] =
{
- { (char*)"ctor", (char*)"(" TYP("AppInfo") ")J", (void*)JniCtor },
+ { (char*)"ctor", (char*)"(" TYP("AppInfo") "J)J", (void*)JniCtor },
{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor },
{ (char*)"setEventCallback", (char*)"(JLjava/lang/String;J)V", (void*)JniSetEventCallback },
@@ -241,8 +219,6 @@ static JNINativeMethod methods[] =
{ (char*)"evaluate", (char*)"(JLjava/lang/String;Ljava/lang/String;)" TYP("JsValue"), (void*)JniEvaluate },
{ (char*)"setDefaultFileSystem", (char*)"(JLjava/lang/String;)V", (void*)JniSetDefaultFileSystem },
- { (char*)"setLogSystem", (char*)"(JJ)V", (void*)JniSetLogSystem },
- { (char*)"setDefaultLogSystem", (char*)"(J)V", (void*)JniSetDefaultLogSystem },
{ (char*)"setWebRequest", (char*)"(JJ)V", (void*)JniSetWebRequest },
{ (char*)"newValue", (char*)"(JJ)" TYP("JsValue"), (void*)JniNewLongValue },

Powered by Google App Engine
This is Rietveld