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

Unified Diff: jni/JniLogSystem.cpp

Issue 6606493159784448: New JNI bindings (Closed)
Patch Set: Style review fixes Created March 28, 2014, 11 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: jni/JniLogSystem.cpp
diff --git a/jni/JniLogSystem.cpp b/jni/JniLogSystem.cpp
index e67f9b53784bc1975a0a46ddb5f52d20e1c5c3cf..dd0b8d7487861c52efeb86e472546f51ebd225fe 100644
--- a/jni/JniLogSystem.cpp
+++ b/jni/JniLogSystem.cpp
@@ -17,20 +17,19 @@
#include "JniCallbacks.h"
-AdblockPlus::Android::JniLogSystemCallback::JniLogSystemCallback(JNIEnv* env, jobject callbackObject) :
- JniCallbackBase(env, callbackObject), AdblockPlus::LogSystem()
+JniLogSystemCallback::JniLogSystemCallback(JNIEnv* env, jobject callbackObject)
+ : JniCallbackBase(env, callbackObject), AdblockPlus::LogSystem()
{
- m_LogLevelClass.reset(new JniGlobalReference<jclass>(env, env->FindClass(PKG("LogSystem$LogLevel"))));
+ logLevelClass.reset(new JniGlobalReference<jclass>(env, env->FindClass(PKG("LogSystem$LogLevel"))));
}
-AdblockPlus::Android::JniLogSystemCallback::~JniLogSystemCallback()
+JniLogSystemCallback::~JniLogSystemCallback()
{
}
-void AdblockPlus::Android::JniLogSystemCallback::operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string& message,
- const std::string& source)
+void JniLogSystemCallback::operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string& message, const std::string& source)
{
- AdblockPlus::Android::JNIEnvAcquire env(GetJavaVM());
+ JNIEnvAcquire env(GetJavaVM());
jclass clazz = env->GetObjectClass(GetCallbackObject());
jmethodID method = env->GetMethodID(clazz, "logCallback", "(" TYP("LogSystem$LogLevel") "Ljava/lang/String;Ljava/lang/String;)V");
@@ -61,7 +60,7 @@ void AdblockPlus::Android::JniLogSystemCallback::operator()(AdblockPlus::LogSyst
break;
}
- jclass enumClass = m_LogLevelClass->get();
+ jclass enumClass = logLevelClass->get();
if (enumClass)
{
jfieldID enumField = env->GetStaticFieldID(enumClass, enumName, TYP("LogSystem$LogLevel"));
@@ -81,20 +80,21 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject)
{
TRY
{
- return AdblockPlus::Android::JniPtr2Long(new AdblockPlus::Android::JniLogSystemCallback(env, callbackObject));
+ return JniPtrToLong(new JniLogSystemCallback(env, callbackObject));
}
CATCH_THROW_AND_RETURN(env, 0)
}
static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
{
- delete AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::Android::JniLogSystemCallback>(ptr);
+ delete JniLongToTypePtr<JniLogSystemCallback>(ptr);
}
static JNINativeMethod methods[] =
{
-{ (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
-{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, };
+ { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
+ { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
+};
extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_android_api_LogSystem_registerNatives(JNIEnv *env, jclass clazz)
{

Powered by Google App Engine
This is Rietveld