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

Delta Between Two Patch Sets: libadblockplus-android/jni/JniFilter.cpp

Issue 29347012: Issue 4188 - Update libadblockplus-android to use the latest libadblockplus (Closed)
Left Patch Set: Changes in libadblockplus-binaries repo Created June 24, 2016, 2:32 p.m.
Right Patch Set: removed ctors with JsValue argument Created Dec. 12, 2016, 2:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include <AdblockPlus.h> 18 #include <AdblockPlus.h>
19 #include "Utils.h" 19 #include "Utils.h"
20 #include "JniJsValue.h" 20 #include "JniJsValue.h"
21 21
22 static AdblockPlus::Filter* GetFilterPtr(jlong ptr) 22 static AdblockPlus::Filter* GetFilterPtr(jlong ptr)
23 { 23 {
24 return JniLongToTypePtr<AdblockPlus::FilterPtr>(ptr)->get(); 24 return JniLongToTypePtr<AdblockPlus::FilterPtr>(ptr)->get();
25 }
26
27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue)
28 {
29 try
30 {
31 return JniPtrToLong(new AdblockPlus::FilterPtr(new AdblockPlus::Filter(JniGe tJsValuePtr(jsValue))));
32 }
33 CATCH_THROW_AND_RETURN(env, 0)
34 } 25 }
35 26
36 static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr) 27 static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr)
37 { 28 {
38 AdblockPlus::Filter::Type type; 29 AdblockPlus::Filter::Type type;
39 try 30 try
40 { 31 {
41 type = GetFilterPtr(ptr)->GetType(); 32 type = GetFilterPtr(ptr)->GetType();
42 } 33 }
43 CATCH_THROW_AND_RETURN(env, 0) 34 CATCH_THROW_AND_RETURN(env, 0)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 97
107 try 98 try
108 { 99 {
109 return *me == *other ? JNI_TRUE : JNI_FALSE; 100 return *me == *other ? JNI_TRUE : JNI_FALSE;
110 } 101 }
111 CATCH_THROW_AND_RETURN(env, JNI_FALSE) 102 CATCH_THROW_AND_RETURN(env, JNI_FALSE)
112 } 103 }
113 104
114 static JNINativeMethod methods[] = 105 static JNINativeMethod methods[] =
115 { 106 {
116 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor },
117 { (char*)"getType", (char*)"(J)" TYP("Filter$Type"), (void*)JniGetType }, 107 { (char*)"getType", (char*)"(J)" TYP("Filter$Type"), (void*)JniGetType },
118 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed }, 108 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed },
119 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList }, 109 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList },
120 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList }, 110 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList },
121 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals } 111 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals }
122 }; 112 };
123 113
124 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Filter_reg isterNatives(JNIEnv *env, jclass clazz) 114 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Filter_reg isterNatives(JNIEnv *env, jclass clazz)
125 { 115 {
126 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 116 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
127 } 117 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld