Move channel registration to constructed vfunc

For the Display Channel and the Cursor channel, move the call to
reds_register_channel() to the _constructed() vfunc rather than calling
it explicitly from RedWorker. This matches what other channels do.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Jonathon Jongsma 2019-03-14 15:03:21 -05:00 committed by Frediano Ziglio
parent 679b63fe6e
commit 6f90c003e8
4 changed files with 14 additions and 3 deletions

View File

@ -366,12 +366,24 @@ cursor_channel_finalize(GObject *object)
G_OBJECT_CLASS(cursor_channel_parent_class)->finalize(object);
}
static void
cursor_channel_constructed(GObject *object)
{
RedChannel *red_channel = RED_CHANNEL(object);
RedsState *reds = red_channel_get_server(red_channel);
G_OBJECT_CLASS(cursor_channel_parent_class)->constructed(object);
reds_register_channel(reds, red_channel);
}
static void
cursor_channel_class_init(CursorChannelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
object_class->constructed = cursor_channel_constructed;
object_class->finalize = cursor_channel_finalize;
channel_class->parser = spice_get_client_channel_parser(SPICE_CHANNEL_CURSOR, NULL);

View File

@ -2305,6 +2305,8 @@ display_channel_constructed(GObject *object)
red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE);
red_channel_set_cap(channel, SPICE_DISPLAY_CAP_STREAM_REPORT);
reds_register_channel(reds, channel);
}
void display_channel_process_surface_cmd(DisplayChannel *display,

View File

@ -701,7 +701,6 @@ stream_device_create_channel(StreamDevice *dev)
client_cbs.connect = (channel_client_connect_proc) cursor_channel_connect;
client_cbs.migrate = cursor_channel_client_migrate;
red_channel_register_client_cbs(RED_CHANNEL(cursor_channel), &client_cbs);
reds_register_channel(reds, RED_CHANNEL(cursor_channel));
dev->stream_channel = stream_channel;
dev->cursor_channel = cursor_channel;

View File

@ -1322,7 +1322,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
red_channel_init_stat_node(channel, &worker->stat, "cursor_channel");
red_channel_register_client_cbs(channel, client_cursor_cbs);
g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
reds_register_channel(reds, channel);
// TODO: handle seamless migration. Temp, setting migrate to FALSE
worker->display_channel = display_channel_new(reds, qxl, &worker->core, FALSE,
@ -1333,7 +1332,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
red_channel_init_stat_node(channel, &worker->stat, "display_channel");
red_channel_register_client_cbs(channel, client_display_cbs);
g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
reds_register_channel(reds, channel);
return worker;
}