-
-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use external message pump when calling MessageLoopWork (to fix bugs and improve performance) #246
Comments
Add new option ApplicationSettings.external_message_pump. This is experimental, actually it makes app slower, reported issue in upstream. Add cefpython.GetAppSetting() func. Show CEF Python version in unit test runner.
External message pump implemented in commit f8286e0. However this is still experimental, actually on Linux it makes app x2 slower and mouse context menu doesn't work. Reported Issue #2002 in upstream CEF. |
It seems that speed of loading web pages is now fixed in CEF v58 with external message pump on Linux. However there are issues with frames being lost (in windowed mode), animation seem laggy even though HTML 5 Peacekeeper test shows the same score for default loop and external message loop. In v58 the ApplicationSettings.external_message_pump is causing segmentation fault on Linux. Looks like src/subprocess/main_message_loop/ C++ files need to be updated (sync with upstream cefclient). |
The segmentation fault occurs only when running hello_world.py example. When running wxpython.py or kivy_.py examples it works fine, however there is a segmentation fault, but only when exiting app. I don't see any difference in performance in kivy_.py example with external message pump. The speed of loading pages is now fixed, however I don't see any difference in frame rate. This might still get better, because external message pump seem still to be broken in upstream. See this comment in upstream CEF which expains the issues in details: https://bitbucket.org/chromiumembedded/cef/issues/2002/external-message-pump-on-linux-is-slow-and#comment-36662023 |
Related issue: #442 ("Message loop work hangs in wxPython / Qt examples on Mac"). |
Todo: Compare cefpython/src/subprocess/main_message_loop* files with cef/tests/shared/browser/main_message_loop* files. These files may have been changed after v66 update.
--
Using external message pump will improve performance, but it is also required to get rid of some bugs, like missing keyboard events on Mac/Windows reported on the CEF Forum in this topic, and this.
Examples that call
cefpython.MessageLoopWork
should implement external message pump.In CEF there are two functions for running message loop:
CefRunMessageLoop
(cefpython.MessageLoop)CefDoMessageLoopWork
(cefpython.MessageLoopWork) - for integrating into existing frameworks.In CEF Python we use message loop work in most examples (only PyWin32 uses MessageLoop). According to CEF doc comments
CefRunMessageLoop
will always have the best performance.Task 1: GTK example should call MessageLoop() on Linux
The pygtk_.py example could use
cefpython.MessageLoop
on Linux. CEF will call GTK's native loop and it should work good - tested in idriissha's fork. Currentlycefpython.MessageLoopWork
is called in a timer.Update: gtk2.py example uses MessageLoop() by default and MessageLoopWork when --message-loop-timer flag is passed. I tried to use MessageLoop() in gtk3.py, but it didn't work.
Task 2: Use external message pump in other examples
There is issue 1805 in upstream CEF to improve support for a host owned message loop. It is now marked as Resolved. The
CefSettings.external_message_pump
option andCefBrowserProcessHandler::OnScheduleMessagePumpWork
method already landed in master and in branch 2743. See this commit. You can pass the--external-message-pump
flag to cefclient to test the new mode and see how it performs.Example implementation in upstream cefclient:
Doc comments for the new functionality:
The text was updated successfully, but these errors were encountered: