Chromium Code Reviews| 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..9ddc2d6eb92696f8cd16898f7a83eae4f7be07fb 100644 |
| --- a/base/android/scoped_java_ref.h |
| +++ b/base/android/scoped_java_ref.h |
| @@ -148,6 +148,21 @@ 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 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_; |
|
no sievers
2014/04/04 20:32:11
DISALLOW_COPY_AND_ASSIGN
reveman
2014/04/04 21:07:08
Done.
|
| +}; |
| + |
| // 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 |