mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add a new CefBrowserHost::SetWindowlessFrameRate method to support
dynamic configuration of the windowless frame rate (issue #1629).
This commit is contained in:
@ -1267,6 +1267,40 @@ void CefBrowserHostImpl::NotifyMoveOrResizeStarted() {
|
||||
PlatformNotifyMoveOrResizeStarted();
|
||||
}
|
||||
|
||||
int CefBrowserHostImpl::GetWindowlessFrameRate() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
return 0;
|
||||
}
|
||||
|
||||
return CefRenderWidgetHostViewOSR::ClampFrameRate(
|
||||
settings_.windowless_frame_rate);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SetWindowlessFrameRate, this,
|
||||
frame_rate));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsWindowless())
|
||||
return;
|
||||
|
||||
settings_.windowless_frame_rate = frame_rate;
|
||||
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(
|
||||
web_contents()->GetRenderViewHost()->GetView());
|
||||
if (view)
|
||||
view->UpdateFrameRate();
|
||||
}
|
||||
|
||||
// CefBrowser methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user