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

Side by Side Diff: chrome/browser/android/recently_closed_tabs_bridge.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/android/recently_closed_tabs_bridge.h" 5 #include "chrome/browser/android/recently_closed_tabs_bridge.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "chrome/browser/android/tab_android.h" 8 #include "chrome/browser/android/tab_android.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_android.h" 10 #include "chrome/browser/profiles/profile_android.h"
(...skipping 12 matching lines...) Expand all
23 23
24 void AddTabToList(JNIEnv* env, 24 void AddTabToList(JNIEnv* env,
25 TabRestoreService::Entry* entry, 25 TabRestoreService::Entry* entry,
26 jobject jtabs_list) { 26 jobject jtabs_list) {
27 const TabRestoreService::Tab* tab = 27 const TabRestoreService::Tab* tab =
28 static_cast<TabRestoreService::Tab*>(entry); 28 static_cast<TabRestoreService::Tab*>(entry);
29 const sessions::SerializedNavigationEntry& current_navigation = 29 const sessions::SerializedNavigationEntry& current_navigation =
30 tab->navigations.at(tab->current_navigation_index); 30 tab->navigations.at(tab->current_navigation_index);
31 Java_RecentlyClosedBridge_pushTab( 31 Java_RecentlyClosedBridge_pushTab(
32 env, jtabs_list, entry->id, 32 env, jtabs_list, entry->id,
33 ConvertUTF16ToJavaString(env, current_navigation.title()).Release(), 33 ConvertUTF16ToJavaString(env, current_navigation.title()).obj(),
34 ConvertUTF8ToJavaString(env, current_navigation.virtual_url().spec()) 34 ConvertUTF8ToJavaString(env, current_navigation.virtual_url().spec())
35 .Release()); 35 .obj());
36 } 36 }
37 37
38 void AddTabsToList(JNIEnv* env, 38 void AddTabsToList(JNIEnv* env,
39 const TabRestoreService::Entries& entries, 39 const TabRestoreService::Entries& entries,
40 jobject jtabs_list, 40 jobject jtabs_list,
41 int max_tab_count) { 41 int max_tab_count) {
42 int added_count = 0; 42 int added_count = 0;
43 for (TabRestoreService::Entries::const_iterator it = entries.begin(); 43 for (TabRestoreService::Entries::const_iterator it = entries.begin();
44 it != entries.end() && added_count < max_tab_count; ++it) { 44 it != entries.end() && added_count < max_tab_count; ++it) {
45 TabRestoreService::Entry* entry = *it; 45 TabRestoreService::Entry* entry = *it;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 static jlong Init(JNIEnv* env, jobject obj, jobject jprofile) { 160 static jlong Init(JNIEnv* env, jobject obj, jobject jprofile) {
161 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge( 161 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge(
162 ProfileAndroid::FromProfileAndroid(jprofile)); 162 ProfileAndroid::FromProfileAndroid(jprofile));
163 return reinterpret_cast<intptr_t>(bridge); 163 return reinterpret_cast<intptr_t>(bridge);
164 } 164 }
165 165
166 // static 166 // static
167 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) { 167 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) {
168 return RegisterNativesImpl(env); 168 return RegisterNativesImpl(env);
169 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/android/history_report/history_report_jni_bridge.cc ('k') | chrome/browser/speech/tts_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698