Flutter Linux Embedder
fl_view_monitor.cc File Reference

Go to the source code of this file.

Classes

struct  _FlViewMonitor
 

Functions

static void first_frame_cb (FlViewMonitor *self)
 
static void fl_view_monitor_dispose (GObject *object)
 
static void fl_view_monitor_class_init (FlViewMonitorClass *klass)
 
static void fl_view_monitor_init (FlViewMonitor *self)
 
G_MODULE_EXPORT FlViewMonitor * fl_view_monitor_new (FlView *view, void(*on_first_frame)(void))
 

Function Documentation

◆ first_frame_cb()

static void first_frame_cb ( FlViewMonitor *  self)
static

Definition at line 25 of file fl_view_monitor.cc.

25  {
26  flutter::IsolateScope scope(self->isolate);
27  if (self->on_first_frame) {
28  self->on_first_frame();
29  }
30 }

Referenced by fl_application_activate(), fl_view_monitor_new(), and setup_engine().

◆ fl_view_monitor_class_init()

static void fl_view_monitor_class_init ( FlViewMonitorClass *  klass)
static

Definition at line 40 of file fl_view_monitor.cc.

40  {
41  G_OBJECT_CLASS(klass)->dispose = fl_view_monitor_dispose;
42 }
static void fl_view_monitor_dispose(GObject *object)

References fl_view_monitor_dispose().

◆ fl_view_monitor_dispose()

static void fl_view_monitor_dispose ( GObject *  object)
static

Definition at line 32 of file fl_view_monitor.cc.

32  {
33  FlViewMonitor* self = FL_VIEW_MONITOR(object);
34 
35  g_clear_object(&self->view);
36 
37  G_OBJECT_CLASS(fl_view_monitor_parent_class)->dispose(object);
38 }

Referenced by fl_view_monitor_class_init().

◆ fl_view_monitor_init()

static void fl_view_monitor_init ( FlViewMonitor *  self)
static

Definition at line 44 of file fl_view_monitor.cc.

44 {}

◆ fl_view_monitor_new()

G_MODULE_EXPORT FlViewMonitor* fl_view_monitor_new ( FlView *  view,
void(*)(void)  on_first_frame 
)

fl_view_monitor_new: @view: the view being monitored. @on_first_frame: the function to call when the first frame is rendered.

Helper class to allow the Flutter engine to monitor a FlView using FFI. Callbacks are called in the isolate this class was created with.

Returns: a new #FlViewMonitor.

Definition at line 46 of file fl_view_monitor.cc.

48  {
49  FlViewMonitor* self =
50  FL_VIEW_MONITOR(g_object_new(fl_view_monitor_get_type(), nullptr));
51 
52  self->view = FL_VIEW(g_object_ref(view));
53  self->isolate = flutter::Isolate::Current();
54  self->on_first_frame = on_first_frame;
55  g_signal_connect_object(view, "first-frame", G_CALLBACK(first_frame_cb), self,
56  G_CONNECT_SWAPPED);
57 
58  return self;
59 }
static Isolate Current()
Definition: isolate_scope.cc:9
FlView * view
static void first_frame_cb(FlViewMonitor *self)

References flutter::Isolate::Current(), first_frame_cb(), and view.