зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1768495 Part 1: Add a method nsIWidget::PauseOrResumeCompositor, and override it in nsCocoaWindow. r=gfx-reviewers,emilio,ahale
This change does not affect behavior, it's just prepatory for a later caller to the newly-defined method. Differential Revision: https://phabricator.services.mozilla.com/D169344
This commit is contained in:
Родитель
20030785f6
Коммит
ce9e905fc3
|
@ -354,8 +354,7 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
|
|||
|
||||
bool InFullScreenMode() const { return mInFullScreenMode; }
|
||||
|
||||
void PauseCompositor();
|
||||
void ResumeCompositor();
|
||||
void PauseOrResumeCompositor(bool aPause) override;
|
||||
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
|
|
|
@ -2111,11 +2111,7 @@ void nsCocoaWindow::DispatchSizeModeEvent() {
|
|||
}
|
||||
|
||||
if (StaticPrefs::widget_pause_compositor_when_minimized()) {
|
||||
if (newMode == nsSizeMode_Minimized) {
|
||||
PauseCompositor();
|
||||
} else {
|
||||
ResumeCompositor();
|
||||
}
|
||||
PauseOrResumeCompositor(newMode == nsSizeMode_Minimized);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2155,30 +2151,6 @@ void nsCocoaWindow::ReportSizeEvent() {
|
|||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
}
|
||||
|
||||
void nsCocoaWindow::PauseCompositor() {
|
||||
nsIWidget* mainChildView = static_cast<nsIWidget*>([[mWindow mainChildView] widget]);
|
||||
if (!mainChildView) {
|
||||
return;
|
||||
}
|
||||
CompositorBridgeChild* remoteRenderer = mainChildView->GetRemoteRenderer();
|
||||
if (!remoteRenderer) {
|
||||
return;
|
||||
}
|
||||
remoteRenderer->SendPause();
|
||||
}
|
||||
|
||||
void nsCocoaWindow::ResumeCompositor() {
|
||||
nsIWidget* mainChildView = static_cast<nsIWidget*>([[mWindow mainChildView] widget]);
|
||||
if (!mainChildView) {
|
||||
return;
|
||||
}
|
||||
CompositorBridgeChild* remoteRenderer = mainChildView->GetRemoteRenderer();
|
||||
if (!remoteRenderer) {
|
||||
return;
|
||||
}
|
||||
remoteRenderer->SendResume();
|
||||
}
|
||||
|
||||
void nsCocoaWindow::SetMenuBar(RefPtr<nsMenuBarX>&& aMenuBar) {
|
||||
if (!mWindow) {
|
||||
mMenuBar = nullptr;
|
||||
|
@ -2598,6 +2570,12 @@ bool nsCocoaWindow::GetEditCommands(NativeKeyBindingsType aType, const WidgetKey
|
|||
return true;
|
||||
}
|
||||
|
||||
void nsCocoaWindow::PauseOrResumeCompositor(bool aPause) {
|
||||
if (auto* mainChildView = static_cast<nsIWidget*>([[mWindow mainChildView] widget])) {
|
||||
mainChildView->PauseOrResumeCompositor(aPause);
|
||||
}
|
||||
}
|
||||
|
||||
bool nsCocoaWindow::AsyncPanZoomEnabled() const {
|
||||
if (mPopupContentView) {
|
||||
return mPopupContentView->AsyncPanZoomEnabled();
|
||||
|
|
|
@ -988,6 +988,18 @@ void nsBaseWidget::CreateCompositor() {
|
|||
CreateCompositor(rect.Width(), rect.Height());
|
||||
}
|
||||
|
||||
void nsIWidget::PauseOrResumeCompositor(bool aPause) {
|
||||
auto* renderer = GetRemoteRenderer();
|
||||
if (!renderer) {
|
||||
return;
|
||||
}
|
||||
if (aPause) {
|
||||
renderer->SendPause();
|
||||
} else {
|
||||
renderer->SendResume();
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<GeckoContentController>
|
||||
nsBaseWidget::CreateRootContentController() {
|
||||
RefPtr<GeckoContentController> controller =
|
||||
|
|
|
@ -1973,6 +1973,11 @@ class nsIWidget : public nsISupports {
|
|||
*/
|
||||
virtual CompositorBridgeChild* GetRemoteRenderer() { return nullptr; }
|
||||
|
||||
/**
|
||||
* If there is a remote renderer, pause or resume it.
|
||||
*/
|
||||
virtual void PauseOrResumeCompositor(bool aPause);
|
||||
|
||||
/**
|
||||
* Clear WebRender resources
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче