Left: | ||
Right: |
OLD | NEW |
---|---|
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 |
(...skipping 10 matching lines...) Expand all Loading... | |
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 } | 25 } |
26 | 26 |
27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue) | 27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue) |
28 { | 28 { |
29 try | 29 try |
30 { | 30 { |
31 return JniPtrToLong(new AdblockPlus::FilterPtr(new AdblockPlus::Filter(JniGe tJsValuePtr(jsValue)))); | 31 return JniPtrToLong(new AdblockPlus::FilterPtr( |
32 *JniLongToTypePtr<AdblockPlus::FilterPtr>(jsValue))); | |
32 } | 33 } |
33 CATCH_THROW_AND_RETURN(env, 0) | 34 CATCH_THROW_AND_RETURN(env, 0) |
34 } | 35 } |
35 | 36 |
36 static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr) | 37 static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr) |
37 { | 38 { |
38 AdblockPlus::Filter::Type type; | 39 AdblockPlus::Filter::Type type; |
39 try | 40 try |
40 { | 41 { |
41 type = GetFilterPtr(ptr)->GetType(); | 42 type = GetFilterPtr(ptr)->GetType(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 107 |
107 try | 108 try |
108 { | 109 { |
109 return *me == *other ? JNI_TRUE : JNI_FALSE; | 110 return *me == *other ? JNI_TRUE : JNI_FALSE; |
110 } | 111 } |
111 CATCH_THROW_AND_RETURN(env, JNI_FALSE) | 112 CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
112 } | 113 } |
113 | 114 |
114 static JNINativeMethod methods[] = | 115 static JNINativeMethod methods[] = |
115 { | 116 { |
116 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, | 117 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, |
sergei
2016/08/30 12:52:54
Who deletes created in JniCtor "new AdblockPlus::F
sergei
2016/08/31 13:21:04
I see that constructor of Filter passes argument t
| |
117 { (char*)"getType", (char*)"(J)" TYP("Filter$Type"), (void*)JniGetType }, | 118 { (char*)"getType", (char*)"(J)" TYP("Filter$Type"), (void*)JniGetType }, |
118 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed }, | 119 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed }, |
119 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList }, | 120 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList }, |
120 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList }, | 121 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList }, |
121 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals } | 122 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals } |
122 }; | 123 }; |
123 | 124 |
124 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Filter_reg isterNatives(JNIEnv *env, jclass clazz) | 125 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Filter_reg isterNatives(JNIEnv *env, jclass clazz) |
125 { | 126 { |
126 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 127 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
127 } | 128 } |
OLD | NEW |