| Flutter Linux Embedder |

Functions
fl_binary_messenger_private.h File Reference
`#include <glib-object.h>`
`#include "flutter/shell/platform/embedder/embedder.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS FlBinaryMessenger * | fl_binary_messenger_new (FlEngine *engine)
gboolean | fl_binary_messenger_handle_message (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, const FlutterPlatformMessageResponseHandle *response_handle)
void | fl_binary_messenger_shutdown (FlBinaryMessenger *messenger)

## Function Documentation

## ◆ fl_binary_messenger_handle_message()

gboolean fl_binary_messenger_handle_message | ( | FlBinaryMessenger * | messenger,
|  | const gchar * | channel,
|  | GBytes * | message,
|  | const FlutterPlatformMessageResponseHandle * | response_handle
| ) |  |

fl_binary_messenger_handle_message: @messenger: an #FlBinaryMessenger. @channel: channel message received on. @message: message data. @response_handle: handle to provide to fl_engine_send_platform_message_response().

Handles a message received from the engine. Available for testing purposes.

Returns: TRUE if the message is handled.

Definition at line 478 of file fl_binary_messenger.cc.

482 {
483 FlBinaryMessengerImpl* self = FL_BINARY_MESSENGER_IMPL(messenger);
484
485 PlatformMessageHandler* handler = static_cast<PlatformMessageHandler*>(
486 g_hash_table_lookup(self->platform_message_handlers, channel));
487 if (handler == nullptr) {
488 return FALSE;
489 }
490
491 g_autoptr(FlBinaryMessengerResponseHandleImpl) handle =
492 fl_binary_messenger_response_handle_impl_new(self, response_handle);
493 handler->message_handler(FL_BINARY_MESSENGER(self), channel, message,
494 FL_BINARY_MESSENGER_RESPONSE_HANDLE(handle),
495 handler->message_handler_data);
496
497 return TRUE;
498 }
fl_binary_messenger_response_handle_impl_new
static FlBinaryMessengerResponseHandleImpl * fl_binary_messenger_response_handle_impl_new(FlBinaryMessengerImpl *messenger, const FlutterPlatformMessageResponseHandle *response_handle)
Definition: fl_binary_messenger.cc:113
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
PlatformMessageHandler
Definition: fl_binary_messenger.cc:126
PlatformMessageHandler::message_handler
FlBinaryMessengerMessageHandler message_handler
Definition: fl_binary_messenger.cc:127
PlatformMessageHandler::message_handler_data
gpointer message_handler_data
Definition: fl_binary_messenger.cc:128

References fl_binary_messenger_response_handle_impl_new(), PlatformMessageHandler::message_handler, PlatformMessageHandler::message_handler_data, and TRUE.

Referenced by fl_binary_messenger_platform_message_cb(), and TEST().

## ◆ fl_binary_messenger_new()

G_BEGIN_DECLS FlBinaryMessenger* fl_binary_messenger_new | ( | FlEngine * | engine | ) |

fl_binary_messenger_new: @engine: The #FlEngine to communicate with.

Creates a new #FlBinaryMessenger. The binary messenger will take control of the engines platform message handler.

Returns: a new #FlBinaryMessenger.

Definition at line 391 of file fl_binary_messenger.cc.

391 {
392 g_return_val_if_fail(FL_IS_ENGINE(engine), nullptr);
393
394 FlBinaryMessengerImpl* self = FL_BINARY_MESSENGER_IMPL(
395 g_object_new(fl_binary_messenger_impl_get_type(), nullptr));
396
397 // Added to stop compiler complaining about an unused function.
398 FL_IS_BINARY_MESSENGER_IMPL(self);
399
400 g_weak_ref_init(&self->engine, G_OBJECT(engine));
401
402 fl_engine_set_platform_message_handler(
403 engine, fl_binary_messenger_platform_message_cb, self, NULL);
404
405 return FL_BINARY_MESSENGER(self);
406 }
fl_binary_messenger_platform_message_cb
static gboolean fl_binary_messenger_platform_message_cb(FlEngine *engine, const gchar *channel, GBytes *message, const FlutterPlatformMessageResponseHandle *response_handle, void *user_data)
Definition: fl_binary_messenger.cc:152
fl_engine_set_platform_message_handler
void fl_engine_set_platform_message_handler(FlEngine *self, FlEnginePlatformMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_engine.cc:848

References fl_binary_messenger_platform_message_cb(), and fl_engine_set_platform_message_handler().

Referenced by fl_engine_new_full(), and TEST().

## ◆ fl_binary_messenger_shutdown()

void fl_binary_messenger_shutdown | ( | FlBinaryMessenger * | messenger | ) |

fl_binary_messenger_shutdown: @messenger: an #FlBinaryMessenger.

Shutdown the messenger closing any open channels.

Definition at line 500 of file fl_binary_messenger.cc.

500 {
501 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
502
503 return FL_BINARY_MESSENGER_GET_IFACE(self)->shutdown(self);
504 }

Referenced by fl_engine_dispose(), fl_test_application_activate(), TEST(), and test_lock_event().