#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
#include "flutter/shell/platform/linux/fl_binary_messenger_private.h"
#include "flutter/fml/logging.h"
#include "flutter/shell/platform/linux/fl_engine_private.h"
#include "flutter/shell/platform/linux/fl_method_codec_private.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_channel.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_codec.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_method_codec.h"
#include <gmodule.h>
Go to the source code of this file.
Classes | |
struct | _FlBinaryMessengerResponseHandleImpl |
struct | PlatformMessageHandler |
Functions | |
G_DEFINE_QUARK (fl_binary_messenger_codec_error_quark, fl_binary_messenger_codec_error) G_DECLARE_FINAL_TYPE(FlBinaryMessengerImpl | |
GObject | G_DECLARE_FINAL_TYPE (FlBinaryMessengerResponseHandleImpl, fl_binary_messenger_response_handle_impl, FL, BINARY_MESSENGER_RESPONSE_HANDLE_IMPL, FlBinaryMessengerResponseHandle) struct _FlBinaryMessengerImpl |
static void | fl_binary_messenger_impl_iface_init (FlBinaryMessengerInterface *iface) |
G_DEFINE_TYPE_WITH_CODE (FlBinaryMessengerImpl, fl_binary_messenger_impl, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(fl_binary_messenger_get_type(), fl_binary_messenger_impl_iface_init)) static void fl_binary_messenger_response_handle_class_init(FlBinaryMessengerResponseHandleClass *klass) | |
G_DEFINE_TYPE (FlBinaryMessengerResponseHandle, fl_binary_messenger_response_handle, G_TYPE_OBJECT) static void fl_binary_messenger_response_handle_init(FlBinaryMessengerResponseHandle *self) | |
G_DEFINE_TYPE (FlBinaryMessengerResponseHandleImpl, fl_binary_messenger_response_handle_impl, fl_binary_messenger_response_handle_get_type()) static void fl_binary_messenger_default_init(FlBinaryMessengerInterface *iface) | |
static void | fl_binary_messenger_response_handle_impl_dispose (GObject *object) |
static void | fl_binary_messenger_response_handle_impl_class_init (FlBinaryMessengerResponseHandleImplClass *klass) |
static void | fl_binary_messenger_response_handle_impl_init (FlBinaryMessengerResponseHandleImpl *self) |
static FlBinaryMessengerResponseHandleImpl * | fl_binary_messenger_response_handle_impl_new (FlBinaryMessengerImpl *messenger, const FlutterPlatformMessageResponseHandle *response_handle) |
static PlatformMessageHandler * | platform_message_handler_new (FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify) |
static void | platform_message_handler_free (gpointer data) |
static gboolean | fl_binary_messenger_platform_message_cb (FlEngine *engine, const gchar *channel, GBytes *message, const FlutterPlatformMessageResponseHandle *response_handle, void *user_data) |
static void | fl_binary_messenger_impl_dispose (GObject *object) |
static void | set_message_handler_on_channel (FlBinaryMessenger *messenger, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify) |
static gboolean | do_unref (gpointer value) |
static gboolean | send_response (FlBinaryMessenger *messenger, FlBinaryMessengerResponseHandle *response_handle_, GBytes *response, GError **error) |
static void | platform_message_ready_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
static void | send_on_channel (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) |
static GBytes * | send_on_channel_finish (FlBinaryMessenger *messenger, GAsyncResult *result, GError **error) |
static gboolean | finish_method (GObject *object, GAsyncResult *result, GError **error) |
static void | resize_channel_response_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
static void | resize_channel (FlBinaryMessenger *messenger, const gchar *channel, int64_t new_size) |
static void | set_warns_on_channel_overflow_response_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
static void | set_warns_on_channel_overflow (FlBinaryMessenger *messenger, const gchar *channel, bool warns) |
static void | shutdown (FlBinaryMessenger *messenger) |
static void | fl_binary_messenger_impl_class_init (FlBinaryMessengerImplClass *klass) |
static void | fl_binary_messenger_impl_init (FlBinaryMessengerImpl *self) |
FlBinaryMessenger * | fl_binary_messenger_new (FlEngine *engine) |
G_MODULE_EXPORT void | fl_binary_messenger_set_message_handler_on_channel (FlBinaryMessenger *self, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify) |
G_MODULE_EXPORT gboolean | fl_binary_messenger_send_response (FlBinaryMessenger *self, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error) |
G_MODULE_EXPORT void | fl_binary_messenger_send_on_channel (FlBinaryMessenger *self, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) |
G_MODULE_EXPORT GBytes * | fl_binary_messenger_send_on_channel_finish (FlBinaryMessenger *self, GAsyncResult *result, GError **error) |
G_MODULE_EXPORT void | fl_binary_messenger_resize_channel (FlBinaryMessenger *self, const gchar *channel, int64_t new_size) |
G_MODULE_EXPORT void | fl_binary_messenger_set_warns_on_channel_overflow (FlBinaryMessenger *self, const gchar *channel, bool warns) |
void | fl_binary_messenger_shutdown (FlBinaryMessenger *self) |
Variables | |
static constexpr char | kControlChannelName [] = "dev.flutter/channel-buffers" |
static constexpr char | kResizeMethod [] = "resize" |
static constexpr char | kOverflowMethod [] = "overflow" |
fl_binary_messenger_impl | |
FL | |
BINARY_MESSENGER_IMPL | |
|
static |
Definition at line 216 of file fl_binary_messenger.cc.
References value.
Referenced by send_response().
|
static |
Definition at line 305 of file fl_binary_messenger.cc.
References error, fl_binary_messenger_send_on_channel_finish(), fl_method_codec_decode_response(), fl_standard_method_codec_new(), and result.
Referenced by perform_action_response_cb(), resize_channel_response_cb(), set_warns_on_channel_overflow_response_cb(), and update_editing_state_response_cb().
|
static |
Definition at line 378 of file fl_binary_messenger.cc.
References fl_binary_messenger_impl_dispose().
|
static |
Definition at line 175 of file fl_binary_messenger.cc.
Referenced by fl_binary_messenger_impl_class_init().
|
static |
Definition at line 383 of file fl_binary_messenger.cc.
References resize_channel(), send_on_channel(), send_on_channel_finish(), send_response(), set_message_handler_on_channel(), set_warns_on_channel_overflow(), and shutdown().
|
static |
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 399 of file fl_binary_messenger.cc.
References fl_binary_messenger_platform_message_cb(), and fl_engine_set_platform_message_handler().
Referenced by fl_engine_new_with_renderer(), TEST(), and test_lock_event().
|
static |
Definition at line 152 of file fl_binary_messenger.cc.
References fl_binary_messenger_response_handle_impl_new(), PlatformMessageHandler::message_handler, PlatformMessageHandler::message_handler_data, TRUE, and user_data.
Referenced by fl_binary_messenger_new().
G_MODULE_EXPORT void fl_binary_messenger_resize_channel | ( | FlBinaryMessenger * | messenger, |
const gchar * | channel, | ||
int64_t | new_size | ||
) |
fl_binary_messenger_resize_channel: @binary_messenger: an #FlBinaryMessenger. @channel: channel to be resize. @new_size: the new size for the channel buffer.
Sends a message to the control channel asking to resize a channel buffer.
Definition at line 467 of file fl_binary_messenger.cc.
Referenced by TEST().
|
static |
Definition at line 103 of file fl_binary_messenger.cc.
References fl_binary_messenger_response_handle_impl_dispose().
|
static |
Definition at line 86 of file fl_binary_messenger.cc.
Referenced by fl_binary_messenger_response_handle_impl_class_init().
|
static |
Definition at line 109 of file fl_binary_messenger.cc.
|
static |
Definition at line 113 of file fl_binary_messenger.cc.
Referenced by fl_binary_messenger_platform_message_cb().
G_MODULE_EXPORT void fl_binary_messenger_send_on_channel | ( | FlBinaryMessenger * | messenger, |
const gchar * | channel, | ||
GBytes * | message, | ||
GCancellable * | cancellable, | ||
GAsyncReadyCallback | callback, | ||
gpointer | user_data | ||
) |
fl_binary_messenger_send_on_channel: @binary_messenger: an #FlBinaryMessenger. @channel: channel to send to. @message: (allow-none): message buffer to send or NULL for an empty message. @cancellable: (allow-none): a #GCancellable or NULL. @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied. @user_data: (closure): user data to pass to @callback.
Asynchronously sends a platform message.
Definition at line 443 of file fl_binary_messenger.cc.
References callback, and user_data.
Referenced by fl_basic_message_channel_send(), fl_event_channel_send(), fl_event_channel_send_end_of_stream(), fl_event_channel_send_error(), fl_method_channel_invoke_method(), resize_channel(), send_lifecycle_state(), set_warns_on_channel_overflow(), and TEST().
G_MODULE_EXPORT GBytes* fl_binary_messenger_send_on_channel_finish | ( | FlBinaryMessenger * | messenger, |
GAsyncResult * | result, | ||
GError ** | error | ||
) |
fl_binary_messenger_send_on_channel_finish: @messenger: an #FlBinaryMessenger.
Completes request started with fl_binary_messenger_send_on_channel().
Returns: (transfer full): message response on success or NULL on error.
Definition at line 457 of file fl_binary_messenger.cc.
Referenced by echo_response_cb(), failure_response_cb(), fake_response_cb(), finish_method(), fl_basic_message_channel_send_finish(), fl_method_channel_invoke_method_finish(), and nullptr_response_cb().
G_MODULE_EXPORT gboolean fl_binary_messenger_send_response | ( | FlBinaryMessenger * | messenger, |
FlBinaryMessengerResponseHandle * | response_handle, | ||
GBytes * | response, | ||
GError ** | error | ||
) |
fl_binary_messenger_send_response: @binary_messenger: an #FlBinaryMessenger. @response_handle: handle that was provided in a FlBinaryMessengerMessageHandler. @response: (allow-none): response to send or NULL for an empty response. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.
Responds to a platform message. This function is thread-safe.
Returns: TRUE on success.
Definition at line 430 of file fl_binary_messenger.cc.
References error.
Referenced by cancel_exception_response_cb(), fake_message_cb(), fl_basic_message_channel_respond(), fl_method_channel_respond(), fl_test_application_activate(), listen_exception_response_cb(), message_cb(), method_call_error_response_cb(), method_call_not_implemented_response_cb(), method_call_success_response_cb(), response_cb(), response_from_thread_main(), send_events_events_cb(), and TEST().
G_MODULE_EXPORT void fl_binary_messenger_set_message_handler_on_channel | ( | FlBinaryMessenger * | messenger, |
const gchar * | channel, | ||
FlBinaryMessengerMessageHandler | handler, | ||
gpointer | user_data, | ||
GDestroyNotify | destroy_notify | ||
) |
FlBinaryMessenger:
#FlBinaryMessenger is an object that allows sending and receiving of platform messages with an #FlEngine. FlBinaryMessengerResponseHandle:
#FlBinaryMessengerResponseHandle is an object used to send responses with. fl_binary_messenger_set_platform_message_handler: @binary_messenger: an #FlBinaryMessenger. @channel: channel to listen on. @handler: (allow-none): function to call when a message is received on this channel or NULL to disable a handler @user_data: (closure): user data to pass to @handler. @destroy_notify: (allow-none): a function which gets called to free @user_data, or NULL.
Sets the function called when a platform message is received on the given channel. See FlBinaryMessengerMessageHandler for details on how to respond to messages.
The handler is removed if the channel is closed or is replaced by another handler, set @destroy_notify if you want to detect this.
Definition at line 416 of file fl_binary_messenger.cc.
References user_data.
Referenced by fl_basic_message_channel_dispose(), fl_basic_message_channel_new(), fl_event_channel_dispose(), fl_event_channel_new(), fl_method_channel_new(), and TEST().
G_MODULE_EXPORT void fl_binary_messenger_set_warns_on_channel_overflow | ( | FlBinaryMessenger * | messenger, |
const gchar * | channel, | ||
bool | warns | ||
) |
fl_binary_messenger_set_warns_on_channel_overflow: @messenger: an #FlBinaryMessenger. @channel: channel to be allowed to overflow silently. @warns: when false, the channel is expected to overflow and warning messages will not be shown.
Sends a message to the control channel asking to allow or disallow a channel to overflow silently.
Definition at line 476 of file fl_binary_messenger.cc.
Referenced by TEST().
void fl_binary_messenger_shutdown | ( | FlBinaryMessenger * | messenger | ) |
fl_binary_messenger_shutdown: @messenger: an #FlBinaryMessenger.
Shutdown the messenger closing any open channels.
Definition at line 486 of file fl_binary_messenger.cc.
Referenced by fl_engine_dispose().
GObject G_DECLARE_FINAL_TYPE | ( | FlBinaryMessengerResponseHandleImpl | , |
fl_binary_messenger_response_handle_impl | , | ||
FL | , | ||
BINARY_MESSENGER_RESPONSE_HANDLE_IMPL | , | ||
FlBinaryMessengerResponseHandle | |||
) |
Definition at line 31 of file fl_binary_messenger.cc.
G_DEFINE_QUARK | ( | fl_binary_messenger_codec_error_quark | , |
fl_binary_messenger_codec_error | |||
) |
G_DEFINE_TYPE | ( | FlBinaryMessengerResponseHandle | , |
fl_binary_messenger_response_handle | , | ||
G_TYPE_OBJECT | |||
) |
Definition at line 61 of file fl_binary_messenger.cc.
G_DEFINE_TYPE | ( | FlBinaryMessengerResponseHandleImpl | , |
fl_binary_messenger_response_handle_impl | , | ||
fl_binary_messenger_response_handle_get_type() | |||
) |
Definition at line 79 of file fl_binary_messenger.cc.
G_DEFINE_TYPE_WITH_CODE | ( | FlBinaryMessengerImpl | , |
fl_binary_messenger_impl | , | ||
G_TYPE_OBJECT | , | ||
G_IMPLEMENT_INTERFACE(fl_binary_messenger_get_type(), fl_binary_messenger_impl_iface_init) | |||
) |
Definition at line 51 of file fl_binary_messenger.cc.
|
static |
Definition at line 144 of file fl_binary_messenger.cc.
References PlatformMessageHandler::message_handler_destroy_notify.
Referenced by fl_binary_messenger_impl_init(), and shutdown().
|
static |
Definition at line 132 of file fl_binary_messenger.cc.
References PlatformMessageHandler::message_handler, and user_data.
Referenced by set_message_handler_on_channel().
|
static |
Definition at line 260 of file fl_binary_messenger.cc.
References result, and user_data.
Referenced by send_on_channel().
|
static |
Definition at line 328 of file fl_binary_messenger.cc.
References args, fl_binary_messenger_send_on_channel(), fl_method_codec_encode_method_call(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), kControlChannelName, kResizeMethod, and resize_channel_response_cb().
Referenced by fl_binary_messenger_impl_iface_init().
|
static |
Definition at line 319 of file fl_binary_messenger.cc.
References error, finish_method(), and result.
Referenced by resize_channel().
|
static |
Definition at line 267 of file fl_binary_messenger.cc.
References callback, fl_engine_send_platform_message(), platform_message_ready_cb(), and user_data.
Referenced by fl_binary_messenger_impl_iface_init().
|
static |
Definition at line 287 of file fl_binary_messenger.cc.
References error, fl_engine_send_platform_message_finish(), and result.
Referenced by fl_binary_messenger_impl_iface_init().
|
static |
Definition at line 222 of file fl_binary_messenger.cc.
References do_unref(), error, FL_BINARY_MESSENGER_ERROR, FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED, fl_engine_send_platform_message_response(), result, and TRUE.
Referenced by fl_binary_messenger_impl_iface_init().
|
static |
Definition at line 185 of file fl_binary_messenger.cc.
References platform_message_handler_new(), and user_data.
Referenced by fl_binary_messenger_impl_iface_init().
|
static |
Definition at line 353 of file fl_binary_messenger.cc.
References args, fl_binary_messenger_send_on_channel(), fl_method_codec_encode_method_call(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_bool(), fl_value_new_list(), fl_value_new_string(), kControlChannelName, kOverflowMethod, and set_warns_on_channel_overflow_response_cb().
Referenced by fl_binary_messenger_impl_iface_init().
|
static |
Definition at line 344 of file fl_binary_messenger.cc.
References error, finish_method(), and result.
Referenced by set_warns_on_channel_overflow().
|
static |
Definition at line 367 of file fl_binary_messenger.cc.
References platform_message_handler_free().
Referenced by fl_binary_messenger_impl_iface_init(), and G_DECLARE_INTERFACE().
BINARY_MESSENGER_IMPL |
Definition at line 28 of file fl_binary_messenger.cc.
FL |
Definition at line 27 of file fl_binary_messenger.cc.
fl_binary_messenger_impl |
Definition at line 26 of file fl_binary_messenger.cc.
|
staticconstexpr |
Definition at line 18 of file fl_binary_messenger.cc.
Referenced by resize_channel(), flutter::internal::ResizeChannel(), set_warns_on_channel_overflow(), and flutter::internal::SetChannelWarnsOnOverflow().
|
staticconstexpr |
Definition at line 20 of file fl_binary_messenger.cc.
Referenced by set_warns_on_channel_overflow(), and flutter::internal::SetChannelWarnsOnOverflow().
|
staticconstexpr |
Definition at line 19 of file fl_binary_messenger.cc.
Referenced by resize_channel(), and flutter::internal::ResizeChannel().