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

Side by Side Diff: libadblockplus-android/jni/Utils.h

Issue 29465639: Issue 5309 - Subscriptions update causes ANR (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: removed unneeded passing of AdblockEngine instance to wrapper listener@anton Created June 16, 2017, 12:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « libadblockplus-android/jni/JniJsEngine.cpp ('k') | libadblockplus-android/jni/Utils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // dynamic_casts to shared_ptr<T: JsValue> ... also as the same inheritance is m irrored on the Java 146 // dynamic_casts to shared_ptr<T: JsValue> ... also as the same inheritance is m irrored on the Java
147 // side (and Java will throw a class cast exception on error) this shouldn't be an issue (TM) 147 // side (and Java will throw a class cast exception on error) this shouldn't be an issue (TM)
148 template<typename T> 148 template<typename T>
149 inline T* JniLongToTypePtr(jlong value) 149 inline T* JniLongToTypePtr(jlong value)
150 { 150 {
151 return reinterpret_cast<T*>((size_t)value); 151 return reinterpret_cast<T*>((size_t)value);
152 } 152 }
153 153
154 std::string JniJavaToStdString(JNIEnv* env, jstring str); 154 std::string JniJavaToStdString(JNIEnv* env, jstring str);
155 jstring JniStdStringToJava(JNIEnv* env, std::string str); 155 jstring JniStdStringToJava(JNIEnv* env, std::string str);
156 bool stringBeginsWith(const std::string& string, const std::string& beginning);
156 157
157 jmethodID JniGetAddToListMethod(JNIEnv* env, jobject list); 158 jmethodID JniGetAddToListMethod(JNIEnv* env, jobject list);
158 159
159 void JniAddObjectToList(JNIEnv* env, jobject list, jmethodID addMethod, jobject value); 160 void JniAddObjectToList(JNIEnv* env, jobject list, jmethodID addMethod, jobject value);
160 161
161 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value); 162 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value);
162 163
163 inline std::string JniGetStringField(JNIEnv* env, jclass clazz, jobject jObj, co nst char* name) 164 inline std::string JniGetStringField(JNIEnv* env, jclass clazz, jobject jObj, co nst char* name)
164 { 165 {
165 return JniJavaToStdString(env, reinterpret_cast<jstring>(env->GetObjectField(j Obj, env->GetFieldID(clazz, name, "Ljava/lang/String;")))); 166 return JniJavaToStdString(env, reinterpret_cast<jstring>(env->GetObjectField(j Obj, env->GetFieldID(clazz, name, "Ljava/lang/String;"))));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 JniThrowException(jEnv, except); \ 210 JniThrowException(jEnv, except); \
210 return retVal; \ 211 return retVal; \
211 } \ 212 } \
212 catch (...) \ 213 catch (...) \
213 { \ 214 { \
214 JniThrowException(jEnv); \ 215 JniThrowException(jEnv); \
215 return retVal; \ 216 return retVal; \
216 } 217 }
217 218
218 #endif 219 #endif
OLDNEW
« no previous file with comments | « libadblockplus-android/jni/JniJsEngine.cpp ('k') | libadblockplus-android/jni/Utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld