On Thu, Jun 21, 2018 at 11:47 PM, Gaute Hope <e...@gaute.vetsj.com> wrote:
Do you have any suggestions for how I could design or circumvent this?

Everything involving I/O that needs to be done on the main loop should be done asynchronously. That's precisely why GLib-based libs have such good support for async operations: To avoid blocking the GUI.

In particular for WebKitGTK, if the data you need to exchange between the GUI process and WebExtension can be trivially formatted and re-parsed (GVariant helps a lot with that), then consider using webkit_web_view_run_javascript() instead of your own custom protobuf IPC.

If the data you need to load from the GUI process is large enough, maybe consider registering a custom URI scheme handler using webkit_web_context_register_uri_scheme(), then let WebKitGTK handle getting the data to the WebProcess asynchronously for you.

If neither of those are a good fit, write an async protobuf wrapper using a background thread, so that when it blocks, it doesn't block the GUI as well.

Geary uses the first two of these approaches with WebKitGTK, and the last approach for interacting asynchronously with SQLite, and they all work quite well.

HTH,
//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>

_______________________________________________
webkit-gtk mailing list
webkit-gtk@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-gtk

Reply via email to