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

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

Issue 29422558: Issue 5167 - Update to use libadblockplus revision dca8df9af1a7 (Closed)
Patch Set: updated dependencies (..-binaries) Created May 3, 2017, 2:08 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/JniFilterChangeCallback.cpp ('k') | libadblockplus-android/jni/JniJsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libadblockplus-android/jni/JniFilterEngine.cpp
diff --git a/libadblockplus-android/jni/JniFilterEngine.cpp b/libadblockplus-android/jni/JniFilterEngine.cpp
index 00a96c5c27e6205fc27b39280ed77cefe04d2aaa..20c3d45da4559a3d7ba1023b4f2552454f9e9c59 100644
--- a/libadblockplus-android/jni/JniFilterEngine.cpp
+++ b/libadblockplus-android/jni/JniFilterEngine.cpp
@@ -19,11 +19,11 @@
#include "Utils.h"
#include "JniCallbacks.h"
-static jobject SubscriptionsToArrayList(JNIEnv* env, std::vector<AdblockPlus::SubscriptionPtr>& subscriptions)
+static jobject SubscriptionsToArrayList(JNIEnv* env, std::vector<AdblockPlus::Subscription>& subscriptions)
{
jobject list = NewJniArrayList(env);
- for (std::vector<AdblockPlus::SubscriptionPtr>::iterator it = subscriptions.begin(), end = subscriptions.end(); it != end; it++)
+ for (std::vector<AdblockPlus::Subscription>::iterator it = subscriptions.begin(), end = subscriptions.end(); it != end; it++)
{
JniAddObjectToList(env, list, NewJniSubscription(env, *it));
}
@@ -98,7 +98,7 @@ static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstrin
try
{
- AdblockPlus::FilterPtr filter = engine->GetFilter(text);
+ AdblockPlus::Filter filter = engine->GetFilter(text);
return NewJniFilter(env, filter);
}
@@ -111,11 +111,11 @@ static jobject JNICALL JniGetListedFilters(JNIEnv* env, jclass clazz, jlong ptr)
try
{
- std::vector<AdblockPlus::FilterPtr> filters = engine->GetListedFilters();
+ std::vector<AdblockPlus::Filter> filters = engine->GetListedFilters();
jobject list = NewJniArrayList(env);
- for (std::vector<AdblockPlus::FilterPtr>::iterator it = filters.begin(), end = filters.end(); it != end; it++)
+ for (std::vector<AdblockPlus::Filter>::iterator it = filters.begin(), end = filters.end(); it != end; it++)
{
JniAddObjectToList(env, list, *JniLocalReference<jobject>(env, NewJniFilter(env, *it)));
}
@@ -132,7 +132,7 @@ static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr,
try
{
- AdblockPlus::SubscriptionPtr subscription = engine->GetSubscription(url);
+ AdblockPlus::Subscription subscription = engine->GetSubscription(url);
return NewJniSubscription(env, subscription);
}
@@ -185,7 +185,7 @@ static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlon
try
{
- std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->GetListedSubscriptions();
+ std::vector<AdblockPlus::Subscription> subscriptions = engine->GetListedSubscriptions();
return SubscriptionsToArrayList(env, subscriptions);
}
@@ -198,7 +198,7 @@ static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz,
try
{
- std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->FetchAvailableSubscriptions();
+ std::vector<AdblockPlus::Subscription> subscriptions = engine->FetchAvailableSubscriptions();
return SubscriptionsToArrayList(env, subscriptions);
}
@@ -224,7 +224,8 @@ static void JNICALL JniSetUpdateAvailableCallback(JNIEnv* env, jclass clazz,
*JniLongToTypePtr<AdblockPlus::FilterEnginePtr>(ptr);
JniUpdateAvailableCallback* const callback =
JniLongToTypePtr<JniUpdateAvailableCallback>(callbackPtr);
- AdblockPlus::FilterEngine::UpdateAvailableCallback updateAvailableCallback =
+
+ const AdblockPlus::FilterEngine::UpdateAvailableCallback updateAvailableCallback =
std::bind(&JniUpdateAvailableCallback::Callback, callback,
std::placeholders::_1);
try
@@ -253,7 +254,7 @@ static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz,
JniFilterChangeCallback* callback = JniLongToTypePtr<JniFilterChangeCallback>(
filterPtr);
- AdblockPlus::FilterEngine::FilterChangeCallback filterCallback =
+ const AdblockPlus::FilterEngine::FilterChangeCallback filterCallback =
std::bind(&JniFilterChangeCallback::Callback, callback,
std::placeholders::_1, std::placeholders::_2);
@@ -325,9 +326,9 @@ static jobject JNICALL JniMatches(JNIEnv* env, jclass clazz, jlong ptr, jstring
try
{
- AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUrl);
+ AdblockPlus::FilterPtr filterPtr = engine->Matches(url, contentType, documentUrl);
- return NewJniFilter(env, filter);
+ return (filterPtr.get() ? NewJniFilter(env, *filterPtr.get()) : 0);
}
CATCH_THROW_AND_RETURN(env, 0)
}
@@ -365,10 +366,9 @@ static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr,
try
{
- AdblockPlus::FilterPtr filter = engine->Matches(url, contentType,
- documentUrls);
+ AdblockPlus::FilterPtr filterPtr = engine->Matches(url, contentType, documentUrls);
- return NewJniFilter(env, filter);
+ return (filterPtr.get() ? NewJniFilter(env, *filterPtr) : 0);
}
CATCH_THROW_AND_RETURN(env, 0)
}
@@ -415,7 +415,7 @@ static jobject JNICALL JniGetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring
try
{
- AdblockPlus::JsValuePtr value = engine->GetPref(pref);
+ AdblockPlus::JsValue value = engine->GetPref(pref);
return NewJniJsValue(env, value);
}
@@ -427,7 +427,7 @@ static void JNICALL JniSetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPr
AdblockPlus::FilterEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::FilterEnginePtr>(ptr);
std::string pref = JniJavaToStdString(env, jPref);
- AdblockPlus::JsValuePtr value = JniGetJsValuePtr(jsValue);
+ const AdblockPlus::JsValue& value = JniGetJsValue(jsValue);
try
{
« no previous file with comments | « libadblockplus-android/jni/JniFilterChangeCallback.cpp ('k') | libadblockplus-android/jni/JniJsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld