Bug 1589022 - Partial support for moving a tab between windows with different APZ enablement. r=nika,tnikkel

This involves two new IPC messages (both async) to propagate the change in
compositor options (of which APZ enablement is one) from the GPU process to
the parent process (via PCompositorBridge) and on to the content process
(via PBrowser).

The support is only partial, in that going from non-APZ to APZ is only
supported if APZ was enabled at the time the window was created.

Depends on D51467

Differential Revision: https://phabricator.services.mozilla.com/D51468

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-11-18 23:13:55 +00:00
parent a2dada2399
commit 7932214c45
8 changed files with 50 additions and 0 deletions

View File

@ -1231,6 +1231,27 @@ mozilla::ipc::IPCResult BrowserChild::RecvInitRendering(
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserChild::RecvCompositorOptionsChanged(
const CompositorOptions& aNewOptions) {
MOZ_ASSERT(mCompositorOptions);
// The only compositor option we currently support changing is APZ
// enablement. Even that is only partially supported for now:
// * Going from APZ to non-APZ is fine - we just flip the stored flag.
// Note that we keep the actors (mApzcTreeManager, and the APZChild
// created in InitAPZState()) around (read on for why).
// * Going from non-APZ to APZ is only supported if we were using
// APZ initially (at InitRendering() time) and we are transitioning
// back. In this case, we just reuse the actors which we kept around.
// Fully supporting a non-APZ to APZ transition (i.e. even in cases
// where we initialized as non-APZ) would require setting up the actors
// here. (In that case, we would also have the options of destroying
// the actors in the APZ --> non-APZ case, and always re-creating them
// during a non-APZ --> APZ transition).
mCompositorOptions->SetUseAPZ(aNewOptions.UseAPZ());
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserChild::RecvUpdateDimensions(
const DimensionInfo& aDimensionInfo) {
// When recording/replaying we need to make sure the dimensions are up to

View File

@ -278,6 +278,9 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
const mozilla::layers::CompositorOptions& aCompositorOptions,
const bool& aLayersConnected);
mozilla::ipc::IPCResult RecvCompositorOptionsChanged(
const mozilla::layers::CompositorOptions& aNewOptions);
mozilla::ipc::IPCResult RecvUpdateDimensions(
const mozilla::dom::DimensionInfo& aDimensionInfo);
mozilla::ipc::IPCResult RecvSizeModeChanged(const nsSizeMode& aSizeMode);

View File

@ -736,6 +736,8 @@ child:
CompositorOptions compositorOptions,
bool layersConnected);
async CompositorOptionsChanged(CompositorOptions newOptions);
async LoadURL(nsCString uri, ShowInfo info);
async ResumeLoad(uint64_t pendingSwitchID, ShowInfo info);

View File

@ -46,6 +46,8 @@ class CompositorOptions {
bool UseAdvancedLayers() const { return mUseAdvancedLayers; }
bool InitiallyPaused() const { return mInitiallyPaused; }
void SetUseAPZ(bool aUseAPZ) { mUseAPZ = aUseAPZ; }
void SetUseAdvancedLayers(bool aUseAdvancedLayers) {
mUseAdvancedLayers = aUseAdvancedLayers;
}

View File

@ -839,6 +839,18 @@ mozilla::ipc::IPCResult CompositorBridgeChild::RecvObserveLayersUpdate(
return IPC_OK();
}
mozilla::ipc::IPCResult CompositorBridgeChild::RecvCompositorOptionsChanged(
const LayersId& aLayersId, const CompositorOptions& aNewOptions) {
MOZ_ASSERT(aLayersId.IsValid());
MOZ_ASSERT(XRE_IsParentProcess());
if (RefPtr<dom::BrowserParent> tab =
dom::BrowserParent::GetBrowserParentFromLayersId(aLayersId)) {
Unused << tab->SendCompositorOptionsChanged(aNewOptions);
}
return IPC_OK();
}
void CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(
TextureClient* aClient) {
if (!aClient) {

View File

@ -298,6 +298,9 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
const LayersId& aLayersId, const LayersObserverEpoch& aEpoch,
const bool& aActive);
mozilla::ipc::IPCResult RecvCompositorOptionsChanged(
const LayersId& aLayersId, const CompositorOptions& aNewOptions);
uint64_t GetNextResourceId();
void ClearSharedFrameMetricsData(LayersId aLayersId);

View File

@ -1760,6 +1760,7 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvAdoptChild(
RefPtr<APZUpdater> oldApzUpdater;
APZCTreeManagerParent* parent;
bool scheduleComposition = false;
bool apzEnablementChanged = false;
RefPtr<ContentCompositorBridgeParent> cpcp;
RefPtr<WebRenderBridgeParent> childWrBridge;
@ -1794,6 +1795,7 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvAdoptChild(
"Moving tab between windows with different APZ enablement. "
"This is supported on a best-effort basis, but some things may "
"break.");
apzEnablementChanged = true;
break;
}
case CompositorOptionsChangeKind::eSupported: {
@ -1864,6 +1866,9 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvAdoptChild(
mApzUpdater->NotifyLayerTreeAdopted(
WRRootId(child, gfxUtils::GetContentRenderRoot()), oldApzUpdater);
}
if (apzEnablementChanged) {
Unused << SendCompositorOptionsChanged(child, mOptions);
}
return IPC_OK();
}

View File

@ -155,6 +155,8 @@ child:
async ObserveLayersUpdate(LayersId aLayersId, LayersObserverEpoch aEpoch, bool aActive);
async CompositorOptionsChanged(LayersId id, CompositorOptions newOptions);
parent:
async __delete__();