| Flutter Linux Embedder |

Functions
fl_plugin_registrar.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registrar.h"`
`#include "flutter/shell/platform/linux/fl_plugin_registrar_private.h"`
`#include <gmodule.h>`

Go to the source code of this file.

## Functions
| G_DECLARE_FINAL_TYPE (FlPluginRegistrarImpl, fl_plugin_registrar_impl, FL, PLUGIN_REGISTRAR_IMPL, GObject) struct _FlPluginRegistrarImpl
static void | fl_plugin_registrar_impl_iface_init (FlPluginRegistrarInterface *iface)
| G_DEFINE_TYPE_WITH_CODE (FlPluginRegistrarImpl, fl_plugin_registrar_impl, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(fl_plugin_registrar_get_type(), fl_plugin_registrar_impl_iface_init)) static void fl_plugin_registrar_default_init(FlPluginRegistrarInterface *iface)
static void | fl_plugin_registrar_impl_dispose (GObject *object)
static void | fl_plugin_registrar_impl_class_init (FlPluginRegistrarImplClass *klass)
static FlBinaryMessenger * | get_messenger (FlPluginRegistrar *registrar)
static FlTextureRegistrar * | get_texture_registrar (FlPluginRegistrar *registrar)
static FlView * | get_view (FlPluginRegistrar *registrar)
static void | fl_plugin_registrar_impl_init (FlPluginRegistrarImpl *self)
FlPluginRegistrar * | fl_plugin_registrar_new (FlView *view, FlBinaryMessenger *messenger, FlTextureRegistrar *texture_registrar)
G_MODULE_EXPORT FlBinaryMessenger * | fl_plugin_registrar_get_messenger (FlPluginRegistrar *self)
G_MODULE_EXPORT FlTextureRegistrar * | fl_plugin_registrar_get_texture_registrar (FlPluginRegistrar *self)
G_MODULE_EXPORT FlView * | fl_plugin_registrar_get_view (FlPluginRegistrar *self)

## Function Documentation

## ◆ fl_plugin_registrar_get_messenger()

G_MODULE_EXPORT FlBinaryMessenger* fl_plugin_registrar_get_messenger | ( | FlPluginRegistrar * | registrar | ) |

FlPluginRegistrar:

#FlPluginRegistrar is used when registering new plugins. fl_plugin_registrar_get_messenger: @registrar: an #FlPluginRegistrar.

Gets the messenger this plugin can communicate with.

Returns: an #FlBinaryMessenger.

Definition at line 106 of file fl_plugin_registrar.cc.

107 {
108 g_return_val_if_fail(FL_IS_PLUGIN_REGISTRAR(self), nullptr);
109
110 return FL_PLUGIN_REGISTRAR_GET_IFACE(self)->get_messenger(self);
111 }

Referenced by TEST().

## ◆ fl_plugin_registrar_get_texture_registrar()

G_MODULE_EXPORT FlTextureRegistrar* fl_plugin_registrar_get_texture_registrar | ( | FlPluginRegistrar * | registrar | ) |

fl_plugin_registrar_get_texture_registrar: @registrar: an #FlPluginRegistrar.

Gets the texture registrar this plugin can communicate with.

Returns: an #FlTextureRegistrar.

Definition at line 113 of file fl_plugin_registrar.cc.

114 {
115 g_return_val_if_fail(FL_IS_PLUGIN_REGISTRAR(self), nullptr);
116
117 return FL_PLUGIN_REGISTRAR_GET_IFACE(self)->get_texture_registrar(self);
118 }

Referenced by TEST().

## ◆ fl_plugin_registrar_get_view()

G_MODULE_EXPORT FlView* fl_plugin_registrar_get_view | ( | FlPluginRegistrar * | registrar | ) |

fl_plugin_registrar_get_view: @registrar: an #FlPluginRegistrar.

Get the view that Flutter is rendering with.

Returns: (allow-none): an #FlView or NULL if running in headless mode.

Definition at line 120 of file fl_plugin_registrar.cc.

120 {
121 g_return_val_if_fail(FL_IS_PLUGIN_REGISTRAR(self), nullptr);
122
123 return FL_PLUGIN_REGISTRAR_GET_IFACE(self)->get_view(self);
124 }

## ◆ fl_plugin_registrar_impl_class_init()

static void fl_plugin_registrar_impl_class_init | ( | FlPluginRegistrarImplClass * | klass | ) |
| static

Definition at line 54 of file fl_plugin_registrar.cc.

55 {
56 G_OBJECT_CLASS(klass)->dispose = fl_plugin_registrar_impl_dispose;
57 }
fl_plugin_registrar_impl_dispose
static void fl_plugin_registrar_impl_dispose(GObject *object)
Definition: fl_plugin_registrar.cc:44

References fl_plugin_registrar_impl_dispose().

## ◆ fl_plugin_registrar_impl_dispose()

static void fl_plugin_registrar_impl_dispose | ( | GObject * | object | ) |
| static

Definition at line 44 of file fl_plugin_registrar.cc.

44 {
45 FlPluginRegistrarImpl* self = FL_PLUGIN_REGISTRAR_IMPL(object);
46
47 g_weak_ref_clear(&self->view);
48 g_clear_object(&self->messenger);
49 g_clear_object(&self->texture_registrar);
50
51 G_OBJECT_CLASS(fl_plugin_registrar_impl_parent_class)->dispose(object);
52 }

Referenced by fl_plugin_registrar_impl_class_init().

## ◆ fl_plugin_registrar_impl_iface_init()

static void fl_plugin_registrar_impl_iface_init | ( | FlPluginRegistrarInterface * | iface | ) |
| static

Definition at line 75 of file fl_plugin_registrar.cc.

76 {
77 iface->get_messenger = get_messenger;
78 iface->get_texture_registrar = get_texture_registrar;
79 iface->get_view = get_view;
80 }
get_view
static FlView * get_view(FlPluginRegistrar *registrar)
Definition: fl_plugin_registrar.cc:69
get_texture_registrar
static FlTextureRegistrar * get_texture_registrar(FlPluginRegistrar *registrar)
Definition: fl_plugin_registrar.cc:64
get_messenger
static FlBinaryMessenger * get_messenger(FlPluginRegistrar *registrar)
Definition: fl_plugin_registrar.cc:59

References get_messenger(), get_texture_registrar(), and get_view().

## ◆ fl_plugin_registrar_impl_init()

static void fl_plugin_registrar_impl_init | ( | FlPluginRegistrarImpl * | self | ) |
| static

Definition at line 82 of file fl_plugin_registrar.cc.

82 {}

## ◆ fl_plugin_registrar_new()

FlPluginRegistrar* fl_plugin_registrar_new | ( | FlView * | view,
|  | FlBinaryMessenger * | messenger,
|  | FlTextureRegistrar * | texture_registrar
| ) |  |

fl_plugin_registrar_new: @view: (allow-none): the #FlView that is being plugged into or NULL for headless mode. @messenger: the #FlBinaryMessenger to communicate with. @texture_registrar: the #FlTextureRegistrar to communicate with.

Creates a new #FlPluginRegistrar.

Returns: a new #FlPluginRegistrar.

Definition at line 84 of file fl_plugin_registrar.cc.

87 {
88 g_return_val_if_fail(view == nullptr || FL_IS_VIEW(view), nullptr);
89 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(messenger), nullptr);
90 g_return_val_if_fail(FL_IS_TEXTURE_REGISTRAR(texture_registrar), nullptr);
91
92 FlPluginRegistrarImpl* self = FL_PLUGIN_REGISTRAR_IMPL(
93 g_object_new(fl_plugin_registrar_impl_get_type(), nullptr));
94
95 // Added to stop compiler complaining about an unused function.
96 FL_IS_PLUGIN_REGISTRAR_IMPL(self);
97
98 g_weak_ref_init(&self->view, view);
99 self->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger));
100 self->texture_registrar =
101 FL_TEXTURE_REGISTRAR(g_object_ref(texture_registrar));
102
103 return FL_PLUGIN_REGISTRAR(self);
104 }
view
FlView * view
Definition: fl_application.cc:35

References view.

Referenced by fl_engine_get_registrar_for_plugin(), and fl_view_get_registrar_for_plugin().

## ◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE | ( | FlPluginRegistrarImpl | ,
|  | fl_plugin_registrar_impl | ,
|  | FL | ,
|  | PLUGIN_REGISTRAR_IMPL | ,
|  | GObject |
| ) |  |

Definition at line 10 of file fl_plugin_registrar.cc.

16 {
17 GObject parent_instance;
18
19 // View that plugin is controlling.
20 GWeakRef view;
21
22 // Messenger to communicate on.
23 FlBinaryMessenger* messenger;
24
25 // Texture registrar in use.
26 FlTextureRegistrar* texture_registrar;
27 };

References view.

## ◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE | ( | FlPluginRegistrarImpl | ,
|  | fl_plugin_registrar_impl | ,
|  | G_TYPE_OBJECT | ,
|  | G_IMPLEMENT_INTERFACE(fl_plugin_registrar_get_type(), fl_plugin_registrar_impl_iface_init) |
| ) |  |

Definition at line 34 of file fl_plugin_registrar.cc.

42 {}

## ◆ get_messenger()

static FlBinaryMessenger* get_messenger | ( | FlPluginRegistrar * | registrar | ) |
| static

Definition at line 59 of file fl_plugin_registrar.cc.

59 {
60 FlPluginRegistrarImpl* self = FL_PLUGIN_REGISTRAR_IMPL(registrar);
61 return self->messenger;
62 }

Referenced by fl_plugin_registrar_impl_iface_init().

## ◆ get_texture_registrar()

static FlTextureRegistrar* get_texture_registrar | ( | FlPluginRegistrar * | registrar | ) |
| static

Definition at line 64 of file fl_plugin_registrar.cc.

64 {
65 FlPluginRegistrarImpl* self = FL_PLUGIN_REGISTRAR_IMPL(registrar);
66 return self->texture_registrar;
67 }

Referenced by fl_plugin_registrar_impl_iface_init().

## ◆ get_view()

static FlView* get_view | ( | FlPluginRegistrar * | registrar | ) |
| static

Definition at line 69 of file fl_plugin_registrar.cc.

69 {
70 FlPluginRegistrarImpl* self = FL_PLUGIN_REGISTRAR_IMPL(registrar);
71 g_autoptr(FlView) view = FL_VIEW(g_weak_ref_get(&self->view));
72 return view;
73 }

References view.

Referenced by fl_plugin_registrar_impl_iface_init().