5#ifndef FLUTTER_FML_PLATFORM_ANDROID_SCOPED_JAVA_REF_H_
6#define FLUTTER_FML_PLATFORM_ANDROID_SCOPED_JAVA_REF_H_
12#include "flutter/fml/macros.h"
44 jobject
obj()
const {
return obj_; }
46 bool is_null()
const {
return obj_ == NULL; }
60 JNIEnv* SetNewLocalRef(JNIEnv*
env, jobject
obj);
61 void SetNewGlobalRef(JNIEnv*
env, jobject
obj);
62 void ResetLocalRef(JNIEnv*
env);
63 void ResetGlobalRef();
64 jobject ReleaseInternal();
69 FML_DISALLOW_COPY_AND_ASSIGN(
JavaRef);
87 FML_DISALLOW_COPY_AND_ASSIGN(
JavaRef);
108 this->SetNewLocalRef(env_, other.
obj());
111 template <
typename U>
126 void Reset() { this->ResetLocalRef(env_); }
128 template <
typename U>
133 this->
Reset(other.env_, other.
obj());
136 template <
typename U>
140 this->
Reset(env_, other.obj());
143 template <
typename U>
145 env_ = this->SetNewLocalRef(
env,
obj);
150 T Release() {
return static_cast<T>(this->ReleaseInternal()); }
174 template <
typename U>
181 void Reset() { this->ResetGlobalRef(); }
183 template <
typename U>
185 this->
Reset(NULL, other.obj());
188 template <
typename U>
190 this->SetNewGlobalRef(
env,
obj);
195 T Release() {
return static_cast<T>(this->ReleaseInternal()); }
JavaRef(JNIEnv *env, T obj)
void Reset(const U &other)
ScopedJavaGlobalRef(const ScopedJavaGlobalRef< T > &other)
ScopedJavaGlobalRef(JNIEnv *env, T obj)
ScopedJavaGlobalRef(const U &other)
void Reset(JNIEnv *env, U obj)
ScopedJavaLocalFrame(JNIEnv *env)
ScopedJavaLocalRef(const U &other)
void Reset(JNIEnv *env, U obj)
void operator=(const ScopedJavaLocalRef< T > &other)
ScopedJavaLocalRef(JNIEnv *env, T obj)
void Reset(const ScopedJavaLocalRef< U > &other)
void Reset(const U &other)
ScopedJavaLocalRef(const ScopedJavaLocalRef< T > &other)