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

Delta Between Two Patch Sets: libadblockplus-android/jni/Utils.h

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Left Patch Set: using method from c++ utils Created April 28, 2017, 10:44 a.m.
Right Patch Set: changed impl for reading file as bytes array, modified test. AndroidFileSystem now does not resolve… Created May 29, 2017, 11:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 13 matching lines...) Expand all
24 #include <stdexcept> 24 #include <stdexcept>
25 #include <memory> 25 #include <memory>
26 26
27 #include <AdblockPlus.h> 27 #include <AdblockPlus.h>
28 28
29 #define PKG(x) "org/adblockplus/libadblockplus/" x 29 #define PKG(x) "org/adblockplus/libadblockplus/" x
30 #define TYP(x) "L" PKG(x) ";" 30 #define TYP(x) "L" PKG(x) ";"
31 31
32 #define ABP_JNI_VERSION JNI_VERSION_1_6 32 #define ABP_JNI_VERSION JNI_VERSION_1_6
33 33
34 namespace AdblockPlus 34 namespace AdblockPlus
sergei 2017/08/07 12:50:00 This will be removed after rabasing.
35 { 35 {
36 namespace Utils 36 namespace Utils
37 { 37 {
38 std::string Slurp(std::istream& stream); 38 std::string Slurp(std::istream& stream);
39 } 39 }
40 } 40 }
41 41
42 void JniUtils_OnLoad(JavaVM* vm, JNIEnv* env, void* reserved); 42 void JniUtils_OnLoad(JavaVM* vm, JNIEnv* env, void* reserved);
43 43
44 void JniUtils_OnUnload(JavaVM* vm, JNIEnv* env, void* reserved); 44 void JniUtils_OnUnload(JavaVM* vm, JNIEnv* env, void* reserved);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // side (and Java will throw a class cast exception on error) this shouldn't be an issue (TM) 155 // side (and Java will throw a class cast exception on error) this shouldn't be an issue (TM)
156 template<typename T> 156 template<typename T>
157 inline T* JniLongToTypePtr(jlong value) 157 inline T* JniLongToTypePtr(jlong value)
158 { 158 {
159 return reinterpret_cast<T*>((size_t)value); 159 return reinterpret_cast<T*>((size_t)value);
160 } 160 }
161 161
162 std::string JniJavaToStdString(JNIEnv* env, jstring str); 162 std::string JniJavaToStdString(JNIEnv* env, jstring str);
163 jstring JniStdStringToJava(JNIEnv* env, std::string str); 163 jstring JniStdStringToJava(JNIEnv* env, std::string str);
164 164
165
sergei 2017/05/22 12:09:07 This line seems unrelated.
anton 2017/05/22 13:04:38 Acknowledged.
166 jmethodID JniGetAddToListMethod(JNIEnv* env, jobject list); 165 jmethodID JniGetAddToListMethod(JNIEnv* env, jobject list);
167 166
168 void JniAddObjectToList(JNIEnv* env, jobject list, jmethodID addMethod, jobject value); 167 void JniAddObjectToList(JNIEnv* env, jobject list, jmethodID addMethod, jobject value);
169 168
170 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value); 169 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value);
171 170
172 inline std::string JniGetStringField(JNIEnv* env, jclass clazz, jobject jObj, co nst char* name) 171 inline std::string JniGetStringField(JNIEnv* env, jclass clazz, jobject jObj, co nst char* name)
173 { 172 {
174 return JniJavaToStdString(env, reinterpret_cast<jstring>(env->GetObjectField(j Obj, env->GetFieldID(clazz, name, "Ljava/lang/String;")))); 173 return JniJavaToStdString(env, reinterpret_cast<jstring>(env->GetObjectField(j Obj, env->GetFieldID(clazz, name, "Ljava/lang/String;"))));
175 } 174 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 JniThrowException(jEnv, except); \ 219 JniThrowException(jEnv, except); \
221 return retVal; \ 220 return retVal; \
222 } \ 221 } \
223 catch (...) \ 222 catch (...) \
224 { \ 223 { \
225 JniThrowException(jEnv); \ 224 JniThrowException(jEnv); \
226 return retVal; \ 225 return retVal; \
227 } 226 }
228 227
229 #endif 228 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld