LEFT | RIGHT |
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value) | 43 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value) |
44 { | 44 { |
45 JniLocalReference<jclass> clazz(env, env->GetObjectClass(list)); | 45 JniLocalReference<jclass> clazz(env, env->GetObjectClass(list)); |
46 jmethodID add = env->GetMethodID(*clazz, "add", "(Ljava/lang/Object;)Z"); | 46 jmethodID add = env->GetMethodID(*clazz, "add", "(Ljava/lang/Object;)Z"); |
47 env->CallBooleanMethod(list, add, value); | 47 env->CallBooleanMethod(list, add, value); |
48 } | 48 } |
49 | 49 |
50 void JniThrowException(JNIEnv* env, const std::string& message) | 50 void JniThrowException(JNIEnv* env, const std::string& message) |
51 { | 51 { |
52 JniLocalReference<jclass> clazz(env, env->FindClass(PKG("AdblockPlusException"
))); | 52 JniLocalReference<jclass> clazz(env, |
| 53 env->FindClass(PKG("AdblockPlusException"))); |
53 env->ThrowNew(*clazz, message.c_str()); | 54 env->ThrowNew(*clazz, message.c_str()); |
54 } | 55 } |
55 | 56 |
56 void JniThrowException(JNIEnv* env, const std::exception& e) | 57 void JniThrowException(JNIEnv* env, const std::exception& e) |
57 { | 58 { |
58 JniThrowException(env, e.what()); | 59 JniThrowException(env, e.what()); |
59 } | 60 } |
60 | 61 |
61 void JniThrowException(JNIEnv* env) | 62 void JniThrowException(JNIEnv* env) |
62 { | 63 { |
(...skipping 15 matching lines...) Expand all Loading... |
78 } | 79 } |
79 } | 80 } |
80 | 81 |
81 JNIEnvAcquire::~JNIEnvAcquire() | 82 JNIEnvAcquire::~JNIEnvAcquire() |
82 { | 83 { |
83 if (attachmentStatus == JNI_EDETACHED) | 84 if (attachmentStatus == JNI_EDETACHED) |
84 { | 85 { |
85 javaVM->DetachCurrentThread(); | 86 javaVM->DetachCurrentThread(); |
86 } | 87 } |
87 } | 88 } |
LEFT | RIGHT |