Flutter Engine
fml::jni::ScopedJavaLocalRef< T > Class Template Reference

#include <scoped_java_ref.h>

Inheritance diagram for fml::jni::ScopedJavaLocalRef< T >:
fml::jni::JavaRef< T >

Public Member Functions

 ScopedJavaLocalRef ()
 
 ScopedJavaLocalRef (const ScopedJavaLocalRef< T > &other)
 
template<typename U >
 ScopedJavaLocalRef (const U &other)
 
 ScopedJavaLocalRef (JNIEnv *env, T obj)
 
 ~ScopedJavaLocalRef ()
 
void operator= (const ScopedJavaLocalRef< T > &other)
 
void Reset ()
 
template<typename U >
void Reset (const ScopedJavaLocalRef< U > &other)
 
template<typename U >
void Reset (const U &other)
 
template<typename U >
void Reset (JNIEnv *env, U obj)
 
Release ()
 
- Public Member Functions inherited from fml::jni::JavaRef< T >
obj () const
 

Additional Inherited Members

- Protected Member Functions inherited from fml::jni::JavaRef< T >
 JavaRef ()
 
 ~JavaRef ()
 
 JavaRef (JNIEnv *env, T obj)
 

Detailed Description

template<typename T>
class fml::jni::ScopedJavaLocalRef< T >

Definition at line 101 of file scoped_java_ref.h.

Constructor & Destructor Documentation

◆ ScopedJavaLocalRef() [1/4]

template<typename T>
fml::jni::ScopedJavaLocalRef< T >::ScopedJavaLocalRef ( )
inline

Definition at line 103 of file scoped_java_ref.h.

103 : env_(NULL) {}

◆ ScopedJavaLocalRef() [2/4]

template<typename T>
fml::jni::ScopedJavaLocalRef< T >::ScopedJavaLocalRef ( const ScopedJavaLocalRef< T > &  other)
inline

Definition at line 107 of file scoped_java_ref.h.

References fml::jni::JavaRef< T >::obj().

107  : env_(other.env_) {
108  this->SetNewLocalRef(env_, other.obj());
109  }

◆ ScopedJavaLocalRef() [3/4]

template<typename T>
template<typename U >
fml::jni::ScopedJavaLocalRef< T >::ScopedJavaLocalRef ( const U &  other)
inlineexplicit

Definition at line 112 of file scoped_java_ref.h.

112  : env_(NULL) {
113  this->Reset(other);
114  }

◆ ScopedJavaLocalRef() [4/4]

template<typename T>
fml::jni::ScopedJavaLocalRef< T >::ScopedJavaLocalRef ( JNIEnv *  env,
obj 
)
inline

Definition at line 118 of file scoped_java_ref.h.

118 : JavaRef<T>(env, obj), env_(env) {}

◆ ~ScopedJavaLocalRef()

template<typename T>
fml::jni::ScopedJavaLocalRef< T >::~ScopedJavaLocalRef ( )
inline

Definition at line 120 of file scoped_java_ref.h.

120 { this->Reset(); }

Member Function Documentation

◆ operator=()

template<typename T>
void fml::jni::ScopedJavaLocalRef< T >::operator= ( const ScopedJavaLocalRef< T > &  other)
inline

Definition at line 124 of file scoped_java_ref.h.

124 { this->Reset(other); }

◆ Release()

template<typename T>
T fml::jni::ScopedJavaLocalRef< T >::Release ( )
inline

Definition at line 150 of file scoped_java_ref.h.

150 { return static_cast<T>(this->ReleaseInternal()); }

◆ Reset() [1/4]

template<typename T>
void fml::jni::ScopedJavaLocalRef< T >::Reset ( )
inline

Definition at line 126 of file scoped_java_ref.h.

126 { this->ResetLocalRef(env_); }

◆ Reset() [2/4]

template<typename T>
template<typename U >
void fml::jni::ScopedJavaLocalRef< T >::Reset ( const ScopedJavaLocalRef< U > &  other)
inline

Definition at line 129 of file scoped_java_ref.h.

References fml::jni::JavaRef< T >::obj().

129  {
130  // We can copy over env_ here as |other| instance must be from the same
131  // thread as |this| local ref. (See class comment for multi-threading
132  // limitations, and alternatives).
133  this->Reset(other.env_, other.obj());
134  }

◆ Reset() [3/4]

template<typename T>
template<typename U >
void fml::jni::ScopedJavaLocalRef< T >::Reset ( const U &  other)
inline

Definition at line 137 of file scoped_java_ref.h.

137  {
138  // If |env_| was not yet set (is still NULL) it will be attached to the
139  // current thread in SetNewLocalRef().
140  this->Reset(env_, other.obj());
141  }

◆ Reset() [4/4]

template<typename T>
template<typename U >
void fml::jni::ScopedJavaLocalRef< T >::Reset ( JNIEnv *  env,
obj 
)
inline

Definition at line 144 of file scoped_java_ref.h.

144  {
145  env_ = this->SetNewLocalRef(env, obj);
146  }

The documentation for this class was generated from the following file: