Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
flutter::FlutterDesktopMessenger Class Reference

#include <flutter_desktop_messenger.h>

Public Member Functions

 FlutterDesktopMessenger ()=default
 
FlutterDesktopMessengerRef ToRef ()
 Convert to FlutterDesktopMessengerRef. More...
 
flutter::FlutterWindowsEngineGetEngine () const
 Getter for the engine field. More...
 
void SetEngine (flutter::FlutterWindowsEngine *arg_engine)
 
FlutterDesktopMessengerAddRef ()
 
void Release ()
 
std::mutex & GetMutex ()
 

Static Public Member Functions

static FlutterDesktopMessengerFromRef (FlutterDesktopMessengerRef ref)
 Convert from FlutterDesktopMessengerRef. More...
 

Detailed Description

A messenger object used to invoke platform messages.

On Windows, the message handler is essentially the |FlutterWindowsEngine|, this allows a handle to the |FlutterWindowsEngine| that will become invalidated if the |FlutterWindowsEngine| is destroyed.

Definition at line 23 of file flutter_desktop_messenger.h.

Constructor & Destructor Documentation

◆ FlutterDesktopMessenger()

flutter::FlutterDesktopMessenger::FlutterDesktopMessenger ( )
default

Member Function Documentation

◆ AddRef()

FlutterDesktopMessenger * flutter::FlutterDesktopMessenger::AddRef ( )
inline

Increments the reference count.

Thread-safe.

Definition at line 50 of file flutter_desktop_messenger.h.

50 {
51 ref_count_.fetch_add(1);
52 return this;
53 }

◆ FromRef()

static FlutterDesktopMessenger * flutter::FlutterDesktopMessenger::FromRef ( FlutterDesktopMessengerRef  ref)
inlinestatic

Convert from FlutterDesktopMessengerRef.

Definition at line 33 of file flutter_desktop_messenger.h.

33 {
34 return reinterpret_cast<FlutterDesktopMessenger*>(ref);
35 }

◆ GetEngine()

flutter::FlutterWindowsEngine * flutter::FlutterDesktopMessenger::GetEngine ( ) const
inline

Getter for the engine field.

Definition at line 38 of file flutter_desktop_messenger.h.

38{ return engine; }

◆ GetMutex()

std::mutex & flutter::FlutterDesktopMessenger::GetMutex ( )
inline

Returns the mutex associated with the |FlutterDesktopMessenger|.

This mutex is used to synchronize reading or writing state inside the |FlutterDesktopMessenger| (ie |engine|).

Definition at line 70 of file flutter_desktop_messenger.h.

70{ return mutex_; }

◆ Release()

void flutter::FlutterDesktopMessenger::Release ( )
inline

Decrements the reference count and deletes the object if the count has gone to zero.

Thread-safe.

Definition at line 59 of file flutter_desktop_messenger.h.

59 {
60 int32_t old_count = ref_count_.fetch_sub(1);
61 if (old_count <= 1) {
62 delete this;
63 }
64 }

◆ SetEngine()

void flutter::FlutterDesktopMessenger::SetEngine ( flutter::FlutterWindowsEngine arg_engine)
inline

Setter for the engine field. Thread-safe.

Definition at line 42 of file flutter_desktop_messenger.h.

42 {
43 std::scoped_lock lock(mutex_);
44 engine = arg_engine;
45 }

◆ ToRef()

FlutterDesktopMessengerRef flutter::FlutterDesktopMessenger::ToRef ( )
inline

Convert to FlutterDesktopMessengerRef.

Definition at line 28 of file flutter_desktop_messenger.h.

28 {
29 return reinterpret_cast<FlutterDesktopMessengerRef>(this);
30 }

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