Flutter Engine
fml::jni::JavaObjectWeakGlobalRef Class Reference

#include <jni_weak_ref.h>

Public Member Functions

 JavaObjectWeakGlobalRef ()
 
 JavaObjectWeakGlobalRef (const JavaObjectWeakGlobalRef &orig)
 
 JavaObjectWeakGlobalRef (JNIEnv *env, jobject obj)
 
virtual ~JavaObjectWeakGlobalRef ()
 
void operator= (const JavaObjectWeakGlobalRef &rhs)
 
ScopedJavaLocalRef< jobject > get (JNIEnv *env) const
 
bool is_empty () const
 
void reset ()
 

Detailed Description

Definition at line 19 of file jni_weak_ref.h.

Constructor & Destructor Documentation

◆ JavaObjectWeakGlobalRef() [1/3]

fml::jni::JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef ( )

Definition at line 13 of file jni_weak_ref.cc.

13 : obj_(NULL) {}

◆ JavaObjectWeakGlobalRef() [2/3]

fml::jni::JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef ( const JavaObjectWeakGlobalRef orig)

Definition at line 15 of file jni_weak_ref.cc.

17  : obj_(NULL) {
18  Assign(orig);
19 }

◆ JavaObjectWeakGlobalRef() [3/3]

fml::jni::JavaObjectWeakGlobalRef::JavaObjectWeakGlobalRef ( JNIEnv *  env,
jobject  obj 
)

Definition at line 21 of file jni_weak_ref.cc.

References FML_DCHECK.

22  : obj_(env->NewWeakGlobalRef(obj)) {
23  FML_DCHECK(obj_);
24 }
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ ~JavaObjectWeakGlobalRef()

fml::jni::JavaObjectWeakGlobalRef::~JavaObjectWeakGlobalRef ( )
virtual

Definition at line 26 of file jni_weak_ref.cc.

References reset().

26  {
27  reset();
28 }

Member Function Documentation

◆ get()

◆ is_empty()

bool fml::jni::JavaObjectWeakGlobalRef::is_empty ( ) const
inline

Definition at line 33 of file jni_weak_ref.h.

References fml::jni::GetRealObject(), and reset().

33 { return obj_ == NULL; }

◆ operator=()

void fml::jni::JavaObjectWeakGlobalRef::operator= ( const JavaObjectWeakGlobalRef rhs)

Definition at line 30 of file jni_weak_ref.cc.

30  {
31  Assign(rhs);
32 }

◆ reset()

void fml::jni::JavaObjectWeakGlobalRef::reset ( )

Definition at line 34 of file jni_weak_ref.cc.

References fml::jni::AttachCurrentThread().

Referenced by is_empty(), and ~JavaObjectWeakGlobalRef().

34  {
35  if (obj_) {
36  AttachCurrentThread()->DeleteWeakGlobalRef(obj_);
37  obj_ = NULL;
38  }
39 }
JNIEnv * AttachCurrentThread()
Definition: jni_util.cc:26

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