| 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 21 matching lines...) Expand all Loading... |
| 32 { | 32 { |
| 33 delete logLevelClass; | 33 delete logLevelClass; |
| 34 logLevelClass = NULL; | 34 logLevelClass = NULL; |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject) | 38 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject) |
| 39 { | 39 { |
| 40 try | 40 try |
| 41 { | 41 { |
| 42 return JniPtrToLong(new JniLogSystemCallback(env, callbackObject)); | 42 return JniPtrToLong(new JniLogSystemCallbackPtr(new JniLogSystemCallback(env
, callbackObject))); |
| 43 } | 43 } |
| 44 CATCH_THROW_AND_RETURN(env, 0) | 44 CATCH_THROW_AND_RETURN(env, 0) |
| 45 } | 45 } |
| 46 | 46 |
| 47 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) | 47 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
| 48 { | 48 { |
| 49 delete JniLongToTypePtr<JniLogSystemCallback>(ptr); | 49 delete JniLongToTypePtr<JniLogSystemCallbackPtr>(ptr); |
| 50 } | 50 } |
| 51 | 51 |
| 52 JniLogSystemCallback::JniLogSystemCallback(JNIEnv* env, jobject callbackObject) | 52 JniLogSystemCallback::JniLogSystemCallback(JNIEnv* env, jobject callbackObject) |
| 53 : JniCallbackBase(env, callbackObject), AdblockPlus::LogSystem() | 53 : JniCallbackBase(env, callbackObject), AdblockPlus::LogSystem() |
| 54 { | 54 { |
| 55 } | 55 } |
| 56 | 56 |
| 57 void JniLogSystemCallback::operator()(AdblockPlus::LogSystem::LogLevel logLevel, | 57 void JniLogSystemCallback::operator()(AdblockPlus::LogSystem::LogLevel logLevel, |
| 58 const std::string& message, const std::string& source) | 58 const std::string& message, const std::string& source) |
| 59 { | 59 { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 static JNINativeMethod methods[] = | 115 static JNINativeMethod methods[] = |
| 116 { | 116 { |
| 117 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, | 117 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, |
| 118 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 118 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_LogSystem_
registerNatives(JNIEnv *env, jclass clazz) | 121 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_LogSystem_
registerNatives(JNIEnv *env, jclass clazz) |
| 122 { | 122 { |
| 123 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 123 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
| 124 } | 124 } |
| OLD | NEW |