Multiple browser in single process client

1,022 views
Skip to first unread message

AdrianoPatrizio

unread,
Mar 14, 2017, 10:34:21 AM3/14/17
to CEF Python
If I create GtkApplication, I can create multiple windows with multiple CefBrowser. I have two questions:
1. If one Cef browser crash, other instances crash too?
2. I need to make communication between the Cef instances, if my method is bad, how can I make communication?

Czarek Tomczak

unread,
Mar 14, 2017, 10:51:49 AM3/14/17
to CEF Python
CEF multi-process architecture is explained in details here:
https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3

Basically there is one Browser process and multiple Renderer processes. CEF lets you manage many browsers in the Browser process (main app process). It is Chromium that decides whether to create a new renderer process for the second browser. It depends whether you're opening in both browsers the same website, and other factors. Chromium manages it to make best resource usage. However you can control it. There are switches in upstream Chromium that can be set (eg. process-per-site), see the CommandLineSwitches API doc. There is also a custom option implemented by CEF Python that can help, see ApplicationSettings["unique_request_context_per_browser"]:

https://github.com/cztomczak/cefpython/blob/master/api/ApplicationSettings.md#unique_request_context_per_browser

You can know if renderer process crashes in RequestHandler.OnRendererProcessTerminated:
https://github.com/cztomczak/cefpython/blob/master/api/RequestHandler.md#onrendererprocessterminated

Czarek Tomczak

unread,
Mar 14, 2017, 10:55:22 AM3/14/17
to CEF Python
1) Depends whether both browsers used the same renderer process. See details in my previous post.
2) If you want to communicate with pages by executing for example js code call Browser.ExecuteJavascript().

AdrianoPatrizio

unread,
Mar 14, 2017, 11:44:32 AM3/14/17
to CEF Python
Thank you for precise explanation.
Reply all
Reply to author
Forward
0 new messages