зеркало из 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:
Родитель
0bcd46b1b0
Коммит
5a99e78cfc
|
@ -354,8 +354,7 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
|
||||||
|
|
||||||
bool InFullScreenMode() const { return mInFullScreenMode; }
|
bool InFullScreenMode() const { return mInFullScreenMode; }
|
||||||
|
|
||||||
void PauseCompositor();
|
void PauseOrResumeCompositor(bool aPause) override;
|
||||||
void ResumeCompositor();
|
|
||||||
|
|
||||||
bool AsyncPanZoomEnabled() const override;
|
bool AsyncPanZoomEnabled() const override;
|
||||||
|
|
||||||
|
|
|
@ -2111,11 +2111,7 @@ void nsCocoaWindow::DispatchSizeModeEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StaticPrefs::widget_pause_compositor_when_minimized()) {
|
if (StaticPrefs::widget_pause_compositor_when_minimized()) {
|
||||||
if (newMode == nsSizeMode_Minimized) {
|
PauseOrResumeCompositor(newMode == nsSizeMode_Minimized);
|
||||||
PauseCompositor();
|
|
||||||
} else {
|
|
||||||
ResumeCompositor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2155,30 +2151,6 @@ void nsCocoaWindow::ReportSizeEvent() {
|
||||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
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) {
|
void nsCocoaWindow::SetMenuBar(RefPtr<nsMenuBarX>&& aMenuBar) {
|
||||||
if (!mWindow) {
|
if (!mWindow) {
|
||||||
mMenuBar = nullptr;
|
mMenuBar = nullptr;
|
||||||
|
@ -2598,6 +2570,12 @@ bool nsCocoaWindow::GetEditCommands(NativeKeyBindingsType aType, const WidgetKey
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsCocoaWindow::PauseOrResumeCompositor(bool aPause) {
|
||||||
|
if (auto* mainChildView = static_cast<nsIWidget*>([[mWindow mainChildView] widget])) {
|
||||||
|
mainChildView->PauseOrResumeCompositor(aPause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool nsCocoaWindow::AsyncPanZoomEnabled() const {
|
bool nsCocoaWindow::AsyncPanZoomEnabled() const {
|
||||||
if (mPopupContentView) {
|
if (mPopupContentView) {
|
||||||
return mPopupContentView->AsyncPanZoomEnabled();
|
return mPopupContentView->AsyncPanZoomEnabled();
|
||||||
|
|
|
@ -988,6 +988,18 @@ void nsBaseWidget::CreateCompositor() {
|
||||||
CreateCompositor(rect.Width(), rect.Height());
|
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>
|
already_AddRefed<GeckoContentController>
|
||||||
nsBaseWidget::CreateRootContentController() {
|
nsBaseWidget::CreateRootContentController() {
|
||||||
RefPtr<GeckoContentController> controller =
|
RefPtr<GeckoContentController> controller =
|
||||||
|
|
|
@ -1973,6 +1973,11 @@ class nsIWidget : public nsISupports {
|
||||||
*/
|
*/
|
||||||
virtual CompositorBridgeChild* GetRemoteRenderer() { return nullptr; }
|
virtual CompositorBridgeChild* GetRemoteRenderer() { return nullptr; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is a remote renderer, pause or resume it.
|
||||||
|
*/
|
||||||
|
virtual void PauseOrResumeCompositor(bool aPause);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear WebRender resources
|
* Clear WebRender resources
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче