Flutter Linux Embedder
fl_message_codec.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include "
flutter/shell/platform/linux/public/flutter_linux/fl_message_codec.h
"
6
7
#include <gmodule.h>
8
9
G_DEFINE_QUARK
(
fl_message_codec_error_quark
, fl_message_codec_error)
10
11
G_DEFINE_TYPE
(FlMessageCodec, fl_message_codec, G_TYPE_OBJECT)
12
13
static
void
fl_message_codec_class_init
(FlMessageCodecClass* klass) {}
14
15
static
void
fl_message_codec_init
(FlMessageCodec*
self
) {}
16
17
G_MODULE_EXPORT GBytes*
fl_message_codec_encode_message
(FlMessageCodec*
self
,
18
FlValue
* message,
19
GError**
error
) {
20
g_return_val_if_fail(FL_IS_MESSAGE_CODEC(
self
),
nullptr
);
21
22
// If the user provided NULL, then make a temporary FlValue object for this to
23
// make it simpler for the subclasses.
24
g_autoptr(
FlValue
) null_value =
nullptr
;
25
if
(message ==
nullptr
) {
26
null_value =
fl_value_new_null
();
27
message = null_value;
28
}
29
30
return
FL_MESSAGE_CODEC_GET_CLASS(
self
)->encode_message(
self
, message,
error
);
31
}
32
33
G_MODULE_EXPORT
FlValue
*
fl_message_codec_decode_message
(FlMessageCodec*
self
,
34
GBytes* message,
35
GError**
error
) {
36
g_return_val_if_fail(FL_IS_MESSAGE_CODEC(
self
),
nullptr
);
37
g_return_val_if_fail(message !=
nullptr
,
nullptr
);
38
39
return
FL_MESSAGE_CODEC_GET_CLASS(
self
)->decode_message(
self
, message,
error
);
40
}
fl_message_codec_class_init
static void fl_message_codec_class_init(FlMessageCodecClass *klass)
Definition:
fl_message_codec.cc:13
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition:
fl_value.h:42
fl_message_codec_error_quark
G_MODULE_EXPORT GQuark fl_message_codec_error_quark(void) G_GNUC_CONST
fl_value_new_null
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition:
fl_value.cc:251
fl_message_codec_decode_message
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
Definition:
fl_message_codec.cc:33
G_DEFINE_QUARK
G_DEFINE_QUARK(fl_binary_messenger_codec_error_quark, fl_binary_messenger_codec_error) G_DECLARE_FINAL_TYPE(FlBinaryMessengerImpl
fl_message_codec.h
G_DEFINE_TYPE
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
Definition:
fl_basic_message_channel.cc:37
fl_message_codec_init
static void fl_message_codec_init(FlMessageCodec *self)
Definition:
fl_message_codec.cc:15
error
const uint8_t uint32_t uint32_t GError ** error
Definition:
fl_pixel_buffer_texture_test.cc:40
fl_message_codec_encode_message
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
Definition:
fl_message_codec.cc:17
shell
platform
linux
fl_message_codec.cc
Generated by
1.8.17