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

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

Issue 29524596: Issue 5556 - make C++ implementation of LogSystem manageable only by JsEngine (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: rebase Created Aug. 24, 2017, 1:39 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
Index: libadblockplus-android/jni/JniJsEngine.cpp
diff --git a/libadblockplus-android/jni/JniJsEngine.cpp b/libadblockplus-android/jni/JniJsEngine.cpp
index a6cc59512a8eec674b98e7f4276cdc233101682c..1b4191b7eb508dbc98d420e45f682b518a1a92d0 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, jlong logSystemPtr)
+static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo, jobject logSystem)
{
AdblockPlus::AppInfo appInfo;
@@ -51,9 +51,9 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo, jlong
JniJsEngine* jniJsEngine = new JniJsEngine();
jniJsEngine->timer = timer.get();
jniJsEngine->jsEngine = AdblockPlus::JsEngine::New(appInfo, std::move(timer));
- if (logSystemPtr)
+ if (logSystem)
{
- jniJsEngine->jsEngine->SetLogSystem(*JniLongToTypePtr<AdblockPlus::LogSystemPtr>(logSystemPtr));
+ jniJsEngine->jsEngine->SetLogSystem(std::make_shared<JniLogSystemCallback>(env, logSystem));
}
return JniPtrToLong(jniJsEngine);
}
@@ -209,7 +209,7 @@ static jobject JNICALL JniNewStringValue(JNIEnv* env, jclass clazz, jlong ptr, j
static JNINativeMethod methods[] =
{
- { (char*)"ctor", (char*)"(" TYP("AppInfo") "J)J", (void*)JniCtor },
+ { (char*)"ctor", (char*)"(" TYP("AppInfo") TYP("LogSystem")")J", (void*)JniCtor },
{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor },
{ (char*)"setEventCallback", (char*)"(JLjava/lang/String;J)V", (void*)JniSetEventCallback },

Powered by Google App Engine
This is Rietveld