зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
MozReview-Commit-ID: 8r037jdHJ0E --HG-- extra : rebase_source : 5f0e406ea6eb497b72f40054ba50cf64a6bd7dfb
This commit is contained in:
Родитель
c19a47d368
Коммит
7e39a2bc59
|
@ -2413,8 +2413,9 @@ TabChild::RecvSetDocShellIsActive(const bool& aIsActive,
|
|||
// We send the current layer observer epoch to the compositor so that
|
||||
// TabParent knows whether a layer update notification corresponds to the
|
||||
// latest SetDocShellIsActive request that was made.
|
||||
ClientLayerManager *manager = mPuppetWidget->GetLayerManager()->AsClientLayerManager();
|
||||
manager->SetLayerObserverEpoch(aLayerObserverEpoch);
|
||||
if (ClientLayerManager* clm = mPuppetWidget->GetLayerManager()->AsClientLayerManager()) {
|
||||
clm->SetLayerObserverEpoch(aLayerObserverEpoch);
|
||||
}
|
||||
|
||||
// docshell is consider prerendered only if not active yet
|
||||
mIsPrerendered &= !aIsActive;
|
||||
|
@ -2588,34 +2589,40 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
|
|||
PRenderFrameChild::Send__delete__(remoteFrame);
|
||||
return false;
|
||||
}
|
||||
nsTArray<LayersBackend> backends;
|
||||
backends.AppendElement(mTextureFactoryIdentifier.mParentBackend);
|
||||
bool success;
|
||||
PLayerTransactionChild* shadowManager =
|
||||
compositorChild->SendPLayerTransactionConstructor(backends,
|
||||
aLayersId, &mTextureFactoryIdentifier, &success);
|
||||
if (!success) {
|
||||
NS_WARNING("failed to properly allocate layer transaction");
|
||||
PRenderFrameChild::Send__delete__(remoteFrame);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!shadowManager) {
|
||||
NS_WARNING("failed to construct LayersChild");
|
||||
// This results in |remoteFrame| being deleted.
|
||||
PRenderFrameChild::Send__delete__(remoteFrame);
|
||||
return false;
|
||||
}
|
||||
|
||||
ShadowLayerForwarder* lf =
|
||||
mPuppetWidget->GetLayerManager(
|
||||
shadowManager, mTextureFactoryIdentifier.mParentBackend)
|
||||
nullptr, mTextureFactoryIdentifier.mParentBackend)
|
||||
->AsShadowForwarder();
|
||||
MOZ_ASSERT(lf && lf->HasShadowManager(),
|
||||
"PuppetWidget should have shadow manager");
|
||||
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
|
||||
ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
|
||||
gfx::VRManagerChild::IdentifyTextureHost(mTextureFactoryIdentifier);
|
||||
// As long as we are creating a ClientLayerManager for the puppet widget,
|
||||
// lf must be non-null here.
|
||||
MOZ_ASSERT(lf);
|
||||
|
||||
if (lf) {
|
||||
nsTArray<LayersBackend> backends;
|
||||
backends.AppendElement(mTextureFactoryIdentifier.mParentBackend);
|
||||
bool success;
|
||||
PLayerTransactionChild* shadowManager =
|
||||
compositorChild->SendPLayerTransactionConstructor(backends,
|
||||
aLayersId, &mTextureFactoryIdentifier, &success);
|
||||
if (!success) {
|
||||
NS_WARNING("failed to properly allocate layer transaction");
|
||||
PRenderFrameChild::Send__delete__(remoteFrame);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!shadowManager) {
|
||||
NS_WARNING("failed to construct LayersChild");
|
||||
// This results in |remoteFrame| being deleted.
|
||||
PRenderFrameChild::Send__delete__(remoteFrame);
|
||||
return false;
|
||||
}
|
||||
|
||||
lf->SetShadowManager(shadowManager);
|
||||
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
|
||||
ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
|
||||
gfx::VRManagerChild::IdentifyTextureHost(mTextureFactoryIdentifier);
|
||||
}
|
||||
|
||||
mRemoteFrame = remoteFrame;
|
||||
if (aLayersId != 0) {
|
||||
|
@ -2997,6 +3004,7 @@ TabChild::CompositorUpdated(const TextureFactoryIdentifier& aNewIdentifier)
|
|||
|
||||
RefPtr<LayerManager> lm = mPuppetWidget->GetLayerManager();
|
||||
ClientLayerManager* clm = lm->AsClientLayerManager();
|
||||
MOZ_ASSERT(clm);
|
||||
|
||||
mTextureFactoryIdentifier = aNewIdentifier;
|
||||
clm->UpdateTextureFactoryIdentifier(aNewIdentifier);
|
||||
|
|
|
@ -584,7 +584,7 @@ PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
|||
mLayerManager = new ClientLayerManager(this);
|
||||
}
|
||||
ShadowLayerForwarder* lf = mLayerManager->AsShadowForwarder();
|
||||
if (!lf->HasShadowManager() && aShadowManager) {
|
||||
if (lf && !lf->HasShadowManager() && aShadowManager) {
|
||||
lf->SetShadowManager(aShadowManager);
|
||||
}
|
||||
return mLayerManager;
|
||||
|
@ -594,7 +594,9 @@ LayerManager*
|
|||
PuppetWidget::RecreateLayerManager(PLayerTransactionChild* aShadowManager)
|
||||
{
|
||||
mLayerManager = new ClientLayerManager(this);
|
||||
mLayerManager->AsShadowForwarder()->SetShadowManager(aShadowManager);
|
||||
if (ShadowLayerForwarder* lf = mLayerManager->AsShadowForwarder()) {
|
||||
lf->SetShadowManager(aShadowManager);
|
||||
}
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
|
|
|
@ -1331,35 +1331,42 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
|
|||
mInitialZoomConstraints.reset();
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier textureFactoryIdentifier;
|
||||
PLayerTransactionChild* shadowManager = nullptr;
|
||||
|
||||
nsTArray<LayersBackend> backendHints;
|
||||
gfxPlatform::GetPlatform()->GetCompositorBackends(ComputeShouldAccelerate(), backendHints);
|
||||
|
||||
bool success = false;
|
||||
if (!backendHints.IsEmpty()) {
|
||||
shadowManager = mCompositorBridgeChild->SendPLayerTransactionConstructor(
|
||||
backendHints, 0, &textureFactoryIdentifier, &success);
|
||||
}
|
||||
|
||||
ShadowLayerForwarder* lf = lm->AsShadowForwarder();
|
||||
// As long as we are creating a ClientLayerManager above lf must be non-null.
|
||||
MOZ_ASSERT(lf);
|
||||
|
||||
if (!success || !lf) {
|
||||
NS_WARNING("Failed to create an OMT compositor.");
|
||||
DestroyCompositor();
|
||||
mLayerManager = nullptr;
|
||||
return;
|
||||
if (lf) {
|
||||
TextureFactoryIdentifier textureFactoryIdentifier;
|
||||
PLayerTransactionChild* shadowManager = nullptr;
|
||||
|
||||
nsTArray<LayersBackend> backendHints;
|
||||
gfxPlatform::GetPlatform()->GetCompositorBackends(ComputeShouldAccelerate(), backendHints);
|
||||
|
||||
bool success = false;
|
||||
if (!backendHints.IsEmpty()) {
|
||||
shadowManager = mCompositorBridgeChild->SendPLayerTransactionConstructor(
|
||||
backendHints, 0, &textureFactoryIdentifier, &success);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
NS_WARNING("Failed to create an OMT compositor.");
|
||||
DestroyCompositor();
|
||||
mLayerManager = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
lf->SetShadowManager(shadowManager);
|
||||
if (ClientLayerManager* clm = lm->AsClientLayerManager()) {
|
||||
clm->UpdateTextureFactoryIdentifier(textureFactoryIdentifier);
|
||||
}
|
||||
// Some popup or transparent widgets may use a different backend than the
|
||||
// compositors used with ImageBridge and VR (and more generally web content).
|
||||
if (WidgetTypeSupportsAcceleration()) {
|
||||
ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
|
||||
gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
lf->SetShadowManager(shadowManager);
|
||||
lm->UpdateTextureFactoryIdentifier(textureFactoryIdentifier);
|
||||
// Some popup or transparent widgets may use a different backend than the
|
||||
// compositors used with ImageBridge and VR (and more generally web content).
|
||||
if (WidgetTypeSupportsAcceleration()) {
|
||||
ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
|
||||
gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
|
||||
}
|
||||
WindowUsesOMTC();
|
||||
|
||||
mLayerManager = lm.forget();
|
||||
|
|
Загрузка…
Ссылка в новой задаче