Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Unified Diff: chrome/browser/android/profiles/profile_downloader_android.cc

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/profiles/profile_downloader_android.cc
diff --git a/chrome/browser/android/profiles/profile_downloader_android.cc b/chrome/browser/android/profiles/profile_downloader_android.cc
index 9560c8688455da5656f959884ac730a084c5de74..c0914d59454adce3d81dfda3b911b811438cca07 100644
--- a/chrome/browser/android/profiles/profile_downloader_android.cc
+++ b/chrome/browser/android/profiles/profile_downloader_android.cc
@@ -120,9 +120,10 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
} // namespace
// static
-jstring GetCachedFullNameForPrimaryAccount(JNIEnv* env,
- jclass clazz,
- jobject jprofile) {
+ScopedJavaLocalRef<jstring> GetCachedFullNameForPrimaryAccount(
+ JNIEnv* env,
+ jclass clazz,
+ jobject jprofile) {
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
ProfileInfoInterface& info =
g_browser_process->profile_manager()->GetProfileInfoCache();
@@ -132,13 +133,14 @@ jstring GetCachedFullNameForPrimaryAccount(JNIEnv* env,
if (index != std::string::npos)
name = info.GetGAIANameOfProfileAtIndex(index);
- return base::android::ConvertUTF16ToJavaString(env, name).Release();
+ return base::android::ConvertUTF16ToJavaString(env, name);
}
// static
-jstring GetCachedGivenNameForPrimaryAccount(JNIEnv* env,
- jclass clazz,
- jobject jprofile) {
+ScopedJavaLocalRef<jstring> GetCachedGivenNameForPrimaryAccount(
+ JNIEnv* env,
+ jclass clazz,
+ jobject jprofile) {
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
ProfileInfoInterface& info =
g_browser_process->profile_manager()->GetProfileInfoCache();
@@ -148,13 +150,13 @@ jstring GetCachedGivenNameForPrimaryAccount(JNIEnv* env,
if (index != std::string::npos)
name = info.GetGAIAGivenNameOfProfileAtIndex(index);
- return base::android::ConvertUTF16ToJavaString(env, name).Release();
+ return base::android::ConvertUTF16ToJavaString(env, name);
}
// static
-jobject GetCachedAvatarForPrimaryAccount(JNIEnv* env,
- jclass clazz,
- jobject jprofile) {
+ScopedJavaLocalRef<jobject> GetCachedAvatarForPrimaryAccount(JNIEnv* env,
+ jclass clazz,
+ jobject jprofile) {
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
ProfileInfoInterface& info =
g_browser_process->profile_manager()->GetProfileInfoCache();
@@ -171,7 +173,7 @@ jobject GetCachedAvatarForPrimaryAccount(JNIEnv* env,
}
}
- return jbitmap.Release();
+ return jbitmap;
}
// static

Powered by Google App Engine
This is Rietveld 408576698