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

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

Issue 29422558: Issue 5167 - Update to use libadblockplus revision dca8df9af1a7 (Closed)
Patch Set: suggestions by Serge Created April 26, 2017, 10:22 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
« no previous file with comments | « libadblockplus-android/jni/JniFilterEngine.cpp ('k') | libadblockplus-android/jni/JniJsValue.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 d30cb3376830a5ea43fea013a4e6c4b08b58bea4..21f15d7d502bf35aaa04b084473ff849bf08cc60 100644
--- a/libadblockplus-android/jni/JniJsEngine.cpp
+++ b/libadblockplus-android/jni/JniJsEngine.cpp
@@ -56,7 +56,8 @@ static void JNICALL JniSetEventCallback(JNIEnv* env, jclass clazz, jlong ptr, js
JniEventCallback* callback = JniLongToTypePtr<JniEventCallback>(jCallbackPtr);
std::string eventName = JniJavaToStdString(env, jEventName);
- AdblockPlus::JsEngine::EventCallback eCallback = std::bind(&JniEventCallback::Callback, callback, std::placeholders::_1);
+ AdblockPlus::JsEngine::EventCallback eCallback =
+ std::bind(&JniEventCallback::Callback, callback, std::placeholders::_1);
try
{
@@ -87,8 +88,7 @@ static jobject JNICALL JniEvaluate(JNIEnv* env, jclass clazz, jlong ptr, jstring
try
{
- AdblockPlus::JsValuePtr jsValue = engine->Evaluate(source, filename);
- return NewJniJsValue(env, jsValue);
+ return NewJniJsValue(env, engine->Evaluate(source, filename));
}
CATCH_THROW_AND_RETURN(env, 0)
}
@@ -107,7 +107,7 @@ static void JNICALL JniTriggerEvent(JNIEnv* env, jclass clazz, jlong ptr, jstrin
for (jsize i = 0; i < length; i++)
{
- args.push_back(JniGetJsValuePtr(ptrs[i]));
+ args.push_back(JniGetJsValue(ptrs[i]));
}
env->ReleasePrimitiveArrayCritical(jJsPtrs, ptrs, JNI_ABORT);
@@ -143,7 +143,6 @@ static void JNICALL JniSetDefaultWebRequest(JNIEnv* env, jclass clazz, jlong ptr
try
{
AdblockPlus::WebRequestPtr webRequest(new AdblockPlus::DefaultWebRequest());
-
engine->SetWebRequest(webRequest);
}
CATCH_AND_THROW(env)
@@ -168,7 +167,8 @@ static void JNICALL JniSetLogSystem(JNIEnv* env, jclass clazz, jlong ptr, jlong
try
{
- AdblockPlus::LogSystemPtr logSystem = *JniLongToTypePtr<AdblockPlus::LogSystemPtr>(logSystemPtr);
+ AdblockPlus::LogSystemPtr logSystem =
sergei 2017/04/26 14:12:56 it seems these changes are unrelated, do you mind
anton 2017/04/27 06:21:01 Acknowledged.
+ *JniLongToTypePtr<AdblockPlus::LogSystemPtr>(logSystemPtr);
engine->SetLogSystem(logSystem);
}
@@ -181,7 +181,8 @@ static void JNICALL JniSetWebRequest(JNIEnv* env, jclass clazz, jlong ptr, jlong
try
{
- AdblockPlus::WebRequestPtr& webRequest = *JniLongToTypePtr<AdblockPlus::WebRequestPtr>(webRequestPtr);
+ AdblockPlus::WebRequestPtr& webRequest =
+ *JniLongToTypePtr<AdblockPlus::WebRequestPtr>(webRequestPtr);
engine->SetWebRequest(webRequest);
}
@@ -194,8 +195,7 @@ static jobject JNICALL JniNewLongValue(JNIEnv* env, jclass clazz, jlong ptr, jlo
try
{
- AdblockPlus::JsValuePtr jsValue = engine->NewValue(static_cast<int64_t>(value));
- return NewJniJsValue(env, jsValue);
+ return NewJniJsValue(env, engine->NewValue(static_cast<int64_t>(value)));
}
CATCH_THROW_AND_RETURN(env, 0)
}
@@ -206,8 +206,7 @@ static jobject JNICALL JniNewBooleanValue(JNIEnv* env, jclass clazz, jlong ptr,
try
{
- AdblockPlus::JsValuePtr jsValue = engine->NewValue(value == JNI_TRUE ? true : false);
- return NewJniJsValue(env, jsValue);
+ return NewJniJsValue(env, engine->NewValue(value == JNI_TRUE ? true : false));
}
CATCH_THROW_AND_RETURN(env, 0)
}
@@ -219,15 +218,14 @@ static jobject JNICALL JniNewStringValue(JNIEnv* env, jclass clazz, jlong ptr, j
try
{
std::string strValue = JniJavaToStdString(env, value);
- AdblockPlus::JsValuePtr jsValue = engine->NewValue(strValue);
- return NewJniJsValue(env, jsValue);
+ return NewJniJsValue(env, engine->NewValue(strValue));
}
CATCH_THROW_AND_RETURN(env, 0)
}
// TODO: List of functions that lack JNI bindings
-//JsValuePtr NewObject();
-//JsValuePtr NewCallback(v8::InvocationCallback callback);
+//JsValue NewObject();
+//JsValue NewCallback(v8::InvocationCallback callback);
//static JsEnginePtr FromArguments(const v8::Arguments& arguments);
//JsValueList ConvertArguments(const v8::Arguments& arguments);
« no previous file with comments | « libadblockplus-android/jni/JniFilterEngine.cpp ('k') | libadblockplus-android/jni/JniJsValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld