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

Unified Diff: base/android/scoped_java_ref.h

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 | « no previous file | base/android/scoped_java_ref.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/scoped_java_ref.h
diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h
index a5d71e2d23b9b8d7ad0447ed7c9c2b54e905c83b..7863c0bef3a21fd908e0a836f8f03240cb591660 100644
--- a/base/android/scoped_java_ref.h
+++ b/base/android/scoped_java_ref.h
@@ -14,6 +14,23 @@
namespace base {
namespace android {
+// Creates a new local reference frame, in which at least a given number of
+// local references can be created. Note that local references already created
+// in previous local frames are still valid in the current local frame.
+class BASE_EXPORT ScopedJavaLocalFrame {
+ public:
+ explicit ScopedJavaLocalFrame(JNIEnv* env);
+ ScopedJavaLocalFrame(JNIEnv* env, int capacity);
+ ~ScopedJavaLocalFrame();
+
+ private:
+ // This class is only good for use on the thread it was created on so
+ // it's safe to cache the non-threadsafe JNIEnv* inside this object.
+ JNIEnv* env_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedJavaLocalFrame);
+};
+
// Forward declare the generic java reference template class.
template<typename T> class JavaRef;
« no previous file with comments | « no previous file | base/android/scoped_java_ref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698