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

Delta Between Two Patch Sets: jni/Utils.cpp

Issue 4761138508070912: Issue 1848 - Clean up local reference handling (Closed)
Left Patch Set: Created Jan. 22, 2015, 6:53 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/Utils.h ('k') | no next file » | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
LEFTRIGHT
« jni/Utils.h ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld