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

Unified Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 2538463002: android: Don't pass ScopedJavaGlobalRef pointers. (Closed)
Patch Set: timeouts are very annoying Created 4 years, 1 month 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/preferences/pref_service_bridge.cc
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc
index 3ba13b0990774750cfeb45a7ce5df47cbeeac681..250be2ffaf2a3ac80e56df8c97fdc43ed4adc87e 100644
--- a/chrome/browser/android/preferences/pref_service_bridge.cc
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -72,6 +72,7 @@ using base::android::CheckException;
using base::android::ConvertJavaStringToUTF8;
using base::android::ConvertUTF8ToJavaString;
using base::android::JavaParamRef;
+using base::android::JavaRef;
using base::android::ScopedJavaLocalRef;
using base::android::ScopedJavaGlobalRef;
using content::BrowserThread;
@@ -732,7 +733,7 @@ static void MarkOriginAsImportantForTesting(
}
static void ShowNoticeAboutOtherFormsOfBrowsingHistory(
- ScopedJavaGlobalRef<jobject>* listener,
+ const JavaRef<jobject>& listener,
bool show) {
JNIEnv* env = AttachCurrentThread();
UMA_HISTOGRAM_BOOLEAN(
@@ -740,17 +741,17 @@ static void ShowNoticeAboutOtherFormsOfBrowsingHistory(
if (!show)
return;
Java_OtherFormsOfBrowsingHistoryListener_showNoticeAboutOtherFormsOfBrowsingHistory(
- env, listener->obj());
+ env, listener);
}
static void EnableDialogAboutOtherFormsOfBrowsingHistory(
- ScopedJavaGlobalRef<jobject>* listener,
+ const JavaRef<jobject>& listener,
bool enabled) {
JNIEnv* env = AttachCurrentThread();
if (!enabled)
return;
Java_OtherFormsOfBrowsingHistoryListener_enableDialogAboutOtherFormsOfBrowsingHistory(
- env, listener->obj());
+ env, listener);
}
static void RequestInfoAboutOtherFormsOfBrowsingHistory(
@@ -762,7 +763,7 @@ static void RequestInfoAboutOtherFormsOfBrowsingHistory(
ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()),
WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()),
base::Bind(&ShowNoticeAboutOtherFormsOfBrowsingHistory,
- base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener))));
+ ScopedJavaGlobalRef<jobject>(env, listener)));
// The one-time notice in the dialog.
browsing_data::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory(
@@ -770,7 +771,7 @@ static void RequestInfoAboutOtherFormsOfBrowsingHistory(
WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()),
chrome::GetChannel(),
base::Bind(&EnableDialogAboutOtherFormsOfBrowsingHistory,
- base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener))));
+ ScopedJavaGlobalRef<jobject>(env, listener)));
}
static void SetAutoplayEnabled(JNIEnv* env,

Powered by Google App Engine
This is Rietveld 408576698