Flutter Windows Embedder
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  }

Referenced by FlutterDesktopMessengerAddRef().

◆ FromRef()

◆ GetEngine()

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

◆ 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_; }

Referenced by FlutterDesktopMessengerLock(), and FlutterDesktopMessengerUnlock().

◆ 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  }

Referenced by FlutterDesktopMessengerRelease().

◆ 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  }

Referenced by FlutterDesktopMessengerAddRef().


The documentation for this class was generated from the following file:
flutter::FlutterDesktopMessenger::FlutterDesktopMessenger
FlutterDesktopMessenger()=default
FlutterDesktopMessengerRef
struct FlutterDesktopMessenger * FlutterDesktopMessengerRef
Definition: flutter_messenger.h:19