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

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

Issue 29465639: Issue 5309 - Subscriptions update causes ANR (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: rebase Created July 5, 2017, 1:47 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
« no previous file with comments | « libadblockplus-android/jni/JniJsEngine.h ('k') | libadblockplus-android/jni/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libadblockplus-android/jni/JniJsEngine.cpp
diff --git a/libadblockplus-android/jni/JniJsEngine.cpp b/libadblockplus-android/jni/JniJsEngine.cpp
index 5e8daf3903388fd48292b84ac112843e31d03b4c..7bc78faaace27a3ccd8300c8bada1bc6dc787e9b 100644
--- a/libadblockplus-android/jni/JniJsEngine.cpp
+++ b/libadblockplus-android/jni/JniJsEngine.cpp
@@ -18,6 +18,7 @@
#include <AdblockPlus.h>
#include "Utils.h"
#include "JniCallbacks.h"
+#include "JniJsEngine.h"
static void TransformAppInfo(JNIEnv* env, jobject jAppInfo, AdblockPlus::AppInfo& appInfo)
{
@@ -34,7 +35,7 @@ static void TransformAppInfo(JNIEnv* env, jobject jAppInfo, AdblockPlus::AppInfo
static AdblockPlus::JsEnginePtr& GetJsEnginePtrRef(jlong ptr)
{
- return *JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
+ return JniLongToTypePtr<JniJsEngine>(ptr)->jsEngine;
}
static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo)
@@ -45,14 +46,18 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo)
try
{
- return JniPtrToLong(new AdblockPlus::JsEnginePtr(AdblockPlus::JsEngine::New(appInfo)));
+ AdblockPlus::TimerPtr timer = AdblockPlus::CreateDefaultTimer();
+ JniJsEngine* jniJsEngine = new JniJsEngine();
+ jniJsEngine->timer = timer.get();
+ jniJsEngine->jsEngine = AdblockPlus::JsEngine::New(appInfo, std::move(timer));
+ return JniPtrToLong(jniJsEngine);
}
CATCH_THROW_AND_RETURN(env, 0)
}
static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
{
- delete JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
+ delete JniLongToTypePtr<JniJsEngine>(ptr);
}
static void JNICALL JniSetEventCallback(JNIEnv* env, jclass clazz, jlong ptr, jstring jEventName, jlong jCallbackPtr)
« no previous file with comments | « libadblockplus-android/jni/JniJsEngine.h ('k') | libadblockplus-android/jni/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld