| Flutter Windows Embedder |

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::FlutterWindowsEngine * | GetEngine () const
| Getter for the engine field. More...
void | SetEngine (flutter::FlutterWindowsEngine *arg_engine)
FlutterDesktopMessenger * | AddRef ()
void | Release ()
std::mutex & | GetMutex ()

## Static Public Member Functions
static FlutterDesktopMessenger * | FromRef (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()

static FlutterDesktopMessenger* flutter::FlutterDesktopMessenger::FromRef | ( | FlutterDesktopMessengerRef | ref | ) |
| inline static

Convert from FlutterDesktopMessengerRef.

Definition at line 33 of file flutter_desktop_messenger.h.

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

Referenced by FlutterDesktopMessengerAddRef(), FlutterDesktopMessengerIsAvailable(), FlutterDesktopMessengerLock(), FlutterDesktopMessengerRelease(), FlutterDesktopMessengerSendResponse(), FlutterDesktopMessengerSendWithReply(), FlutterDesktopMessengerSetCallback(), and FlutterDesktopMessengerUnlock().

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

Referenced by FlutterDesktopMessengerIsAvailable(), FlutterDesktopMessengerSendResponse(), FlutterDesktopMessengerSendWithReply(), and FlutterDesktopMessengerSetCallback().

## ◆ 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:

- shell/platform/windows/flutter_desktop_messenger.h

flutter::FlutterDesktopMessenger::FlutterDesktopMessenger
FlutterDesktopMessenger()=default
FlutterDesktopMessengerRef
struct FlutterDesktopMessenger * FlutterDesktopMessengerRef
Definition: flutter_messenger.h:19