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

Side by Side Diff: components/web_contents_delegate_android/web_contents_delegate_android.cc

Issue 1294333002: Fix wrong usages of ScopedJavaLocalRef::Release(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to Release() explaining it should not be used to call java methods 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 unified diff | Download patch
« no previous file with comments | « components/gcm_driver/gcm_driver_android.cc ('k') | content/shell/android/shell_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/web_contents_delegate_android/web_contents_delegate_android .h" 5 #include "components/web_contents_delegate_android/web_contents_delegate_android .h"
6 6
7 #include <android/keycodes.h> 7 #include <android/keycodes.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 return; 254 return;
255 255
256 ScopedJavaLocalRef<jobject> jsource_contents; 256 ScopedJavaLocalRef<jobject> jsource_contents;
257 if (source_contents) 257 if (source_contents)
258 jsource_contents = source_contents->GetJavaWebContents(); 258 jsource_contents = source_contents->GetJavaWebContents();
259 ScopedJavaLocalRef<jobject> jnew_contents; 259 ScopedJavaLocalRef<jobject> jnew_contents;
260 if (new_contents) 260 if (new_contents)
261 jnew_contents = new_contents->GetJavaWebContents(); 261 jnew_contents = new_contents->GetJavaWebContents();
262 262
263 Java_WebContentsDelegateAndroid_webContentsCreated( 263 Java_WebContentsDelegateAndroid_webContentsCreated(
264 env, 264 env, obj.obj(), jsource_contents.obj(), opener_render_frame_id,
265 obj.obj(), 265 base::android::ConvertUTF8ToJavaString(env, frame_name).obj(),
266 jsource_contents.obj(), 266 base::android::ConvertUTF8ToJavaString(env, target_url.spec()).obj(),
267 opener_render_frame_id,
268 base::android::ConvertUTF8ToJavaString(env, frame_name).Release(),
269 base::android::ConvertUTF8ToJavaString(env, target_url.spec()).Release(),
270 jnew_contents.obj()); 267 jnew_contents.obj());
271 } 268 }
272 269
273 void WebContentsDelegateAndroid::CloseContents(WebContents* source) { 270 void WebContentsDelegateAndroid::CloseContents(WebContents* source) {
274 JNIEnv* env = AttachCurrentThread(); 271 JNIEnv* env = AttachCurrentThread();
275 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); 272 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
276 if (obj.is_null()) 273 if (obj.is_null())
277 return; 274 return;
278 Java_WebContentsDelegateAndroid_closeContents(env, obj.obj()); 275 Java_WebContentsDelegateAndroid_closeContents(env, obj.obj());
279 } 276 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // Native JNI methods 438 // Native JNI methods
442 // ---------------------------------------------------------------------------- 439 // ----------------------------------------------------------------------------
443 440
444 // Register native methods 441 // Register native methods
445 442
446 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { 443 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) {
447 return RegisterNativesImpl(env); 444 return RegisterNativesImpl(env);
448 } 445 }
449 446
450 } // namespace web_contents_delegate_android 447 } // namespace web_contents_delegate_android
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_driver_android.cc ('k') | content/shell/android/shell_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698