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..08893006c1569e0f89d03ab5f631358986d92ad7 100644 |
--- a/base/android/scoped_java_ref.h |
+++ b/base/android/scoped_java_ref.h |
@@ -148,6 +148,23 @@ class ScopedJavaLocalRef : public JavaRef<T> { |
JNIEnv* env_; |
}; |
+// 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 { |
bulach
2014/04/07 15:51:29
nit: may I ask to move this one either as the firs
reveman
2014/04/07 17:38:29
Done.
|
+ 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); |
+}; |
+ |
// Holds a global reference to a Java object. The global reference is scoped |
// to the lifetime of this object. This class does not hold onto any JNIEnv* |
// passed to it, hence it is safe to use across threads (within the constraints |