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

Side by Side Diff: libadblockplus-android/jni/JniShowNotificationCallback.cpp

Issue 29354787: Issue 4442 - Cache class and ctors references in JNI_Load/UnLoad (Closed)
Patch Set: reverted to NewTuple Created Nov. 21, 2016, 8:25 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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-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 15 matching lines...) Expand all
26 CATCH_THROW_AND_RETURN(env, 0) 26 CATCH_THROW_AND_RETURN(env, 0)
27 } 27 }
28 28
29 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) 29 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
30 { 30 {
31 delete JniLongToTypePtr<JniShowNotificationCallback>(ptr); 31 delete JniLongToTypePtr<JniShowNotificationCallback>(ptr);
32 } 32 }
33 33
34 JniShowNotificationCallback::JniShowNotificationCallback(JNIEnv* env, 34 JniShowNotificationCallback::JniShowNotificationCallback(JNIEnv* env,
35 jobject callbackObject) 35 jobject callbackObject)
36 : JniCallbackBase(env, callbackObject), notificationClass( 36 : JniCallbackBase(env, callbackObject)
37 new JniGlobalReference<jclass>(env, env->FindClass(PKG("Notification"))) )
38 { 37 {
39 } 38 }
40 39
41 void JniShowNotificationCallback::Callback( 40 void JniShowNotificationCallback::Callback(
42 const AdblockPlus::NotificationPtr& notificationPtr) 41 const AdblockPlus::NotificationPtr& notificationPtr)
43 { 42 {
44 JNIEnvAcquire env(GetJavaVM()); 43 JNIEnvAcquire env(GetJavaVM());
45 44
46 jmethodID method = env->GetMethodID( 45 jmethodID method = env->GetMethodID(
47 *JniLocalReference<jclass>(*env, 46 *JniLocalReference<jclass>(*env,
(...skipping 13 matching lines...) Expand all
61 static JNINativeMethod methods[] = 60 static JNINativeMethod methods[] =
62 { 61 {
63 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, 62 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
64 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } 63 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
65 }; 64 };
66 65
67 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_ShowNotifi cationCallback_registerNatives(JNIEnv *env, jclass clazz) 66 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_ShowNotifi cationCallback_registerNatives(JNIEnv *env, jclass clazz)
68 { 67 {
69 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 68 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
70 } 69 }
OLDNEW
« no previous file with comments | « libadblockplus-android/jni/JniNotification.cpp ('k') | libadblockplus-android/jni/JniWebRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld