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

Delta Between Two Patch Sets: jni/JniLogSystem.cpp

Issue 4761138508070912: Issue 1848 - Clean up local reference handling (Closed)
Left Patch Set: Removed member variable prefixes Created Jan. 23, 2015, 1:16 p.m.
Right Patch Set: Stupid auto-formatter^^ Created Feb. 4, 2015, 12:04 p.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
« no previous file with change/comment | « jni/JniJsValue.cpp ('k') | jni/JniUpdateAvailableCallback.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 "(" TYP("LogSystem$LogLevel") "Ljava/lang/String;Ljava/lang/String;)V"); 48 "(" TYP("LogSystem$LogLevel") "Ljava/lang/String;Ljava/lang/String;)V");
49 49
50 // TODO: Set log level from Java and handle it here (to reduce C++->Java calls ) 50 // TODO: Set log level from Java and handle it here (to reduce C++->Java calls )
51 51
52 if (method) 52 if (method)
53 { 53 {
54 const char* enumName = 0; 54 const char* enumName = 0;
55 55
56 switch (logLevel) 56 switch (logLevel)
57 { 57 {
58 default: 58 default:
Felix Dahlke 2015/02/03 05:22:50 This was fine as it was actually - we don't indent
René Jeschke 2015/02/03 13:51:26 We do this in libadblockplus, the old JNI code her
Felix Dahlke 2015/02/04 04:11:50 Oops, you're right :P But still, unrelated change
René Jeschke 2015/02/04 12:02:47 Yep, you're right on this, too. Will up a 'Noissue
59 case AdblockPlus::LogSystem::LOG_LEVEL_TRACE: 59 case AdblockPlus::LogSystem::LOG_LEVEL_TRACE:
60 enumName = "TRACE"; 60 enumName = "TRACE";
61 break; 61 break;
62 case AdblockPlus::LogSystem::LOG_LEVEL_LOG: 62 case AdblockPlus::LogSystem::LOG_LEVEL_LOG:
63 enumName = "LOG"; 63 enumName = "LOG";
64 break; 64 break;
65 case AdblockPlus::LogSystem::LOG_LEVEL_INFO: 65 case AdblockPlus::LogSystem::LOG_LEVEL_INFO:
66 enumName = "INFO"; 66 enumName = "INFO";
67 break; 67 break;
68 case AdblockPlus::LogSystem::LOG_LEVEL_WARN: 68 case AdblockPlus::LogSystem::LOG_LEVEL_WARN:
69 enumName = "WARN"; 69 enumName = "WARN";
70 break; 70 break;
71 case AdblockPlus::LogSystem::LOG_LEVEL_ERROR: 71 case AdblockPlus::LogSystem::LOG_LEVEL_ERROR:
72 enumName = "ERROR"; 72 enumName = "ERROR";
73 break; 73 break;
74 } 74 }
75 75
76 jclass enumClass = logLevelClass->Get(); 76 jclass enumClass = logLevelClass->Get();
77 if (enumClass) 77 if (enumClass)
78 { 78 {
79 jfieldID enumField = env->GetStaticFieldID(enumClass, enumName, 79 jfieldID enumField = env->GetStaticFieldID(enumClass, enumName,
80 TYP("LogSystem$LogLevel")); 80 TYP("LogSystem$LogLevel"));
81 JniLocalReference<jobject> jLogLevel(*env, 81 JniLocalReference<jobject> jLogLevel(*env,
82 env->GetStaticObjectField(enumClass, enumField)); 82 env->GetStaticObjectField(enumClass, enumField));
83 83
(...skipping 13 matching lines...) Expand all
97 static JNINativeMethod methods[] = 97 static JNINativeMethod methods[] =
98 { 98 {
99 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, 99 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
100 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } 100 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
101 }; 101 };
102 102
103 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_LogSystem_ registerNatives(JNIEnv *env, jclass clazz) 103 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_LogSystem_ registerNatives(JNIEnv *env, jclass clazz)
104 { 104 {
105 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 105 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
106 } 106 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld