mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Improvements in Performance due to adopted usage of CEF Message Loop (#1017)
* Changing the way how we pump the CEF update loop to improve performance * Updated Intervall description
This commit is contained in:
committed by
liuloppan
parent
ede1a9dd42
commit
a66e872e4e
@@ -43,8 +43,9 @@ void WebBrowserApp::OnContextCreated(CefRefPtr<CefBrowser>, CefRefPtr<CefFrame>,
|
||||
void WebBrowserApp::OnBeforeCommandLineProcessing(const CefString&,
|
||||
CefRefPtr<CefCommandLine> commandLine)
|
||||
{
|
||||
// command_line->AppendSwitch("disable-gpu");
|
||||
// command_line->AppendSwitch("disable-gpu-compositing");
|
||||
commandLine->AppendSwitch("disable-gpu");
|
||||
commandLine->AppendSwitch("disable-gpu-compositing");
|
||||
commandLine->AppendSwitch("enable-begin-frame-scheduling");
|
||||
commandLine->AppendSwitchWithValue("autoplay-policy", "no-user-gesture-required");
|
||||
}
|
||||
|
||||
|
||||
@@ -142,16 +142,6 @@ void WebBrowserModule::internalInitialize(const ghoul::Dictionary& dictionary) {
|
||||
_cefHost = std::make_unique<CefHost>(_webHelperLocation);
|
||||
LDEBUG("Starting CEF... done!");
|
||||
|
||||
global::callback::preSync.emplace_back([this]() {
|
||||
if (_cefHost && !_browsers.empty()) {
|
||||
_cefHost->doMessageLoopWork();
|
||||
|
||||
const std::chrono::time_point<std::chrono::high_resolution_clock> timeAfter =
|
||||
std::chrono::high_resolution_clock::now();
|
||||
webbrowser::latestCall = timeAfter;
|
||||
}
|
||||
});
|
||||
|
||||
if (dictionary.hasValue<bool>(UpdateBrowserBetweenRenderablesInfo.identifier)) {
|
||||
_updateBrowserBetweenRenderables =
|
||||
dictionary.value<bool>(UpdateBrowserBetweenRenderablesInfo.identifier);
|
||||
@@ -218,14 +208,18 @@ bool WebBrowserModule::isEnabled() const {
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
namespace webbrowser {
|
||||
|
||||
/**
|
||||
* Logic for the webbrowser performance hotfix,
|
||||
* described in more detail in globalscallbacks.h.
|
||||
*/
|
||||
namespace webbrowser {
|
||||
|
||||
std::chrono::microseconds interval = std::chrono::microseconds(1);
|
||||
/**
|
||||
* The time interval to describe how often the CEF message loop needs to
|
||||
* be pumped to work properly. A value of 10000 us updates CEF a 100 times
|
||||
* per second which is enough for fluid interaction without wasting resources
|
||||
*/
|
||||
std::chrono::microseconds interval = std::chrono::microseconds(10000);
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> latestCall;
|
||||
CefHost* cefHost = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user