Flutter Engine
The Flutter Engine
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
9G_DEFINE_QUARK(fl_message_codec_error_quark, fl_message_codec_error)
10
11G_DEFINE_TYPE(FlMessageCodec, fl_message_codec, G_TYPE_OBJECT)
12
13static void fl_message_codec_class_init(FlMessageCodecClass* klass) {}
14
15static void fl_message_codec_init(FlMessageCodec* self) {}
16
17G_MODULE_EXPORT GBytes* fl_message_codec_encode_message(FlMessageCodec* self,
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
33G_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}
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
G_DEFINE_QUARK(fl_binary_messenger_codec_error_quark, fl_binary_messenger_codec_error) G_DECLARE_FINAL_TYPE(FlBinaryMessengerImpl
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
static void fl_message_codec_init(FlMessageCodec *self)
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
static void fl_message_codec_class_init(FlMessageCodecClass *klass)
G_MODULE_EXPORT GQuark fl_message_codec_error_quark(void) G_GNUC_CONST
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
Win32Message message