This way we would avoid all the GScource + polling mechanism that GST uses internally to handle messages asynchronously in the main thread.
Created attachment 264584 [details]
Created attachment 264591 [details]
I was assuming that sync message handler was always called from a secondary thread, but the main thread can also call gst_bus_post, so I've added a check to not schedule the message to the main thread if we are already in the main thread.
Comment on attachment 264591 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=264591&action=review
Looks good, I'll leave it to Phil to approve it.
> + if (!weakThis)
> + return;
> + weakThis->handleMessage(protectMessage.get());
Nit: could be a two-liner.
> if (weakThis)
Committed r191948: <http://trac.webkit.org/changeset/191948>