Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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.

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

◆ ~JavaObjectWeakGlobalRef()

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

Definition at line 26 of file jni_weak_ref.cc.

26 {
27 reset();
28}

Member Function Documentation

◆ get()

ScopedJavaLocalRef< jobject > fml::jni::JavaObjectWeakGlobalRef::get ( JNIEnv *  env) const

Definition at line 41 of file jni_weak_ref.cc.

41 {
42 return GetRealObject(env, obj_);
43}
ScopedJavaLocalRef< jobject > GetRealObject(JNIEnv *env, jweak obj)
Definition: jni_weak_ref.cc:45

◆ is_empty()

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

Definition at line 33 of file jni_weak_ref.h.

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.

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

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