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

Unified Diff: base/android/scoped_java_ref.cc

Issue 225283008: base: Add ScopedJavaLocalFrame class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set kDefaultLocalFrameCapacity to 16. 512 is much higher than necessary and might fail. Created 6 years, 8 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
« no previous file with comments | « base/android/scoped_java_ref.h ('k') | content/app/android/child_process_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/scoped_java_ref.cc
diff --git a/base/android/scoped_java_ref.cc b/base/android/scoped_java_ref.cc
index 21b466e958423f52b6e5f5657a51056e0a146fbc..bb6f5032fe3454dfc2011c5a6a38c603714a84c5 100644
--- a/base/android/scoped_java_ref.cc
+++ b/base/android/scoped_java_ref.cc
@@ -9,6 +9,24 @@
namespace base {
namespace android {
+namespace {
+
+const int kDefaultLocalFrameCapacity = 16;
+
+} // namespace
+
+ScopedJavaLocalFrame::ScopedJavaLocalFrame(JNIEnv* env) : env_(env) {
+ int failed = env_->PushLocalFrame(kDefaultLocalFrameCapacity);
+ DCHECK(!failed);
+}
+
+ScopedJavaLocalFrame::ScopedJavaLocalFrame(JNIEnv* env, int capacity)
+ : env_(env) {
+ int failed = env_->PushLocalFrame(capacity);
+ DCHECK(!failed);
+}
+
+ScopedJavaLocalFrame::~ScopedJavaLocalFrame() { env_->PopLocalFrame(NULL); }
JavaRef<jobject>::JavaRef() : obj_(NULL) {}
« no previous file with comments | « base/android/scoped_java_ref.h ('k') | content/app/android/child_process_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698