diff options
author | torne <torne@chromium.org> | 2015-08-24 12:37:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-24 19:38:10 +0000 |
commit | be33e691030b6de0351d9a7eeaaca218685dd5bb (patch) | |
tree | f9e7bd15502e090132a148646bf0722c70324931 /remoting | |
parent | f890af39bcb3fa4b86f9b07b9d2f047cd3f0fbdf (diff) | |
download | chromium_src-be33e691030b6de0351d9a7eeaaca218685dd5bb.zip chromium_src-be33e691030b6de0351d9a7eeaaca218685dd5bb.tar.gz chromium_src-be33e691030b6de0351d9a7eeaaca218685dd5bb.tar.bz2 |
jni_generator: Make all object-returning natives return ScopedJavaLocalRef.
Instead of only expecting C++ methods to return ScopedJavaLocalRefs for
object return values, apply this to all native functions. This further
reduces the difference between methods and nonmethods. The vast majority
of native nonmethod functions already have a ScopedJavaLocalRef and
currently write "return foo.Release()" to return it, so this is a fairly
small change in actual behaviour; only a few functions need to create
one.
Also, remove the namespace qualifiers from the existing generated
references to ScopedJavaLocalRef, since jni_generator_helper.h already
includes a "using" declaration for it.
BUG=379897
Review URL: https://codereview.chromium.org/1288183004
Cr-Commit-Position: refs/heads/master@{#345147}
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/jni/chromoting_jni_runtime.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc index c532e74..130c895 100644 --- a/remoting/client/jni/chromoting_jni_runtime.cc +++ b/remoting/client/jni/chromoting_jni_runtime.cc @@ -51,21 +51,20 @@ static void LoadNative(JNIEnv* env, jclass clazz, jobject context) { remoting::ChromotingJniRuntime::GetInstance(); } -static jstring GetApiKey(JNIEnv* env, jclass clazz) { - return ConvertUTF8ToJavaString( - env, google_apis::GetAPIKey().c_str()).Release(); +static ScopedJavaLocalRef<jstring> GetApiKey(JNIEnv* env, jclass clazz) { + return ConvertUTF8ToJavaString(env, google_apis::GetAPIKey().c_str()); } -static jstring GetClientId(JNIEnv* env, jclass clazz) { +static ScopedJavaLocalRef<jstring> GetClientId(JNIEnv* env, jclass clazz) { return ConvertUTF8ToJavaString( - env, google_apis::GetOAuth2ClientID( - google_apis::CLIENT_REMOTING).c_str()).Release(); + env, + google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING).c_str()); } -static jstring GetClientSecret(JNIEnv* env, jclass clazz) { +static ScopedJavaLocalRef<jstring> GetClientSecret(JNIEnv* env, jclass clazz) { return ConvertUTF8ToJavaString( - env, google_apis::GetOAuth2ClientSecret( - google_apis::CLIENT_REMOTING).c_str()).Release(); + env, + google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING).c_str()); } static void Connect(JNIEnv* env, |