mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 745148, part 6: Allow layer trees to be given IDs so that the referent can be used in another context. r=ajuma sr=roc
This commit is contained in:
parent
fe1f8e08af
commit
ec578f2342
@ -1031,7 +1031,8 @@ TabChild::InitWidget(const nsIntSize& size)
|
||||
"shouldn't have a shadow manager yet");
|
||||
LayerManager::LayersBackend be;
|
||||
PRInt32 maxTextureSize;
|
||||
PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor(&be, &maxTextureSize);
|
||||
uint64_t id;
|
||||
PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor(&be, &maxTextureSize, &id);
|
||||
if (!shadowManager) {
|
||||
NS_WARNING("failed to construct LayersChild");
|
||||
// This results in |remoteFrame| being deleted.
|
||||
|
@ -208,7 +208,7 @@ public:
|
||||
LAYERS_LAST
|
||||
};
|
||||
|
||||
LayerManager() : mDestroyed(false), mSnapEffectiveTransforms(true)
|
||||
LayerManager() : mDestroyed(false), mSnapEffectiveTransforms(true), mId(0)
|
||||
{
|
||||
InitLog();
|
||||
}
|
||||
@ -518,6 +518,7 @@ protected:
|
||||
|
||||
static void InitLog();
|
||||
static PRLogModuleInfo* sLog;
|
||||
uint64_t mId;
|
||||
private:
|
||||
TimeStamp mLastFrameTime;
|
||||
nsTArray<float> mFrameTimes;
|
||||
|
@ -42,7 +42,7 @@ CompositorChild::Destroy()
|
||||
}
|
||||
|
||||
PLayersChild*
|
||||
CompositorChild::AllocPLayers(const LayersBackend &aBackend, int* aMaxTextureSize)
|
||||
CompositorChild::AllocPLayers(const LayersBackend &aBackend, const uint64_t& aId, int* aMaxTextureSize)
|
||||
{
|
||||
return new ShadowLayersChild();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
void Destroy();
|
||||
|
||||
protected:
|
||||
virtual PLayersChild* AllocPLayers(const LayersBackend &aBackend, int* aMaxTextureSize);
|
||||
virtual PLayersChild* AllocPLayers(const LayersBackend &aBackend, const uint64_t& aId, int* aMaxTextureSize);
|
||||
virtual bool DeallocPLayers(PLayersChild *aChild);
|
||||
|
||||
private:
|
||||
|
@ -539,8 +539,12 @@ CompositorParent::ShadowLayersUpdated(ShadowLayersParent* aLayerTree,
|
||||
}
|
||||
|
||||
PLayersParent*
|
||||
CompositorParent::AllocPLayers(const LayersBackend& aBackendType, int* aMaxTextureSize)
|
||||
CompositorParent::AllocPLayers(const LayersBackend& aBackendType,
|
||||
const uint64_t& aId,
|
||||
int32_t* aMaxTextureSize)
|
||||
{
|
||||
MOZ_ASSERT(aId == 0);
|
||||
|
||||
// mWidget doesn't belong to the compositor thread, so it should be set to
|
||||
// NULL before returning from this method, to avoid accessing it elsewhere.
|
||||
nsIntRect rect;
|
||||
@ -569,7 +573,7 @@ CompositorParent::AllocPLayers(const LayersBackend& aBackendType, int* aMaxTextu
|
||||
return NULL;
|
||||
}
|
||||
*aMaxTextureSize = layerManager->GetMaxTextureSize();
|
||||
return new ShadowLayersParent(slm, this);
|
||||
return new ShadowLayersParent(slm, this, 0);
|
||||
} else if (aBackendType == LayerManager::LAYERS_BASIC) {
|
||||
nsRefPtr<LayerManager> layerManager = new BasicShadowLayerManager(mWidget);
|
||||
mWidget = NULL;
|
||||
@ -579,7 +583,7 @@ CompositorParent::AllocPLayers(const LayersBackend& aBackendType, int* aMaxTextu
|
||||
return NULL;
|
||||
}
|
||||
*aMaxTextureSize = layerManager->GetMaxTextureSize();
|
||||
return new ShadowLayersParent(slm, this);
|
||||
return new ShadowLayersParent(slm, this, 0);
|
||||
} else {
|
||||
NS_ERROR("Unsupported backend selected for Async Compositor");
|
||||
return NULL;
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
static void ShutDown();
|
||||
|
||||
protected:
|
||||
virtual PLayersParent* AllocPLayers(const LayersBackend& aBackendType, int* aMaxTextureSize);
|
||||
virtual PLayersParent* AllocPLayers(const LayersBackend& aBackendType, const uint64_t& aId, int32_t* aMaxTextureSize);
|
||||
virtual bool DeallocPLayers(PLayersParent* aLayers);
|
||||
virtual void ScheduleTask(CancelableTask*, int);
|
||||
virtual void Composite();
|
||||
|
@ -38,8 +38,8 @@ parent:
|
||||
sync Pause();
|
||||
sync Resume();
|
||||
|
||||
sync PLayers(LayersBackend backend)
|
||||
returns (int maxTextureSize);
|
||||
sync PLayers(LayersBackend backend, uint64_t id)
|
||||
returns (int32_t maxTextureSize);
|
||||
};
|
||||
|
||||
} // layers
|
||||
|
@ -90,8 +90,12 @@ ShadowChild(const OpRemoveChild& op)
|
||||
//--------------------------------------------------
|
||||
// ShadowLayersParent
|
||||
ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager,
|
||||
ShadowLayersManager* aLayersManager)
|
||||
: mLayerManager(aManager), mShadowLayersManager(aLayersManager), mDestroyed(false)
|
||||
ShadowLayersManager* aLayersManager,
|
||||
uint64_t aId)
|
||||
: mLayerManager(aManager)
|
||||
, mShadowLayersManager(aLayersManager)
|
||||
, mId(aId)
|
||||
, mDestroyed(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ShadowLayersParent);
|
||||
}
|
||||
|
@ -31,13 +31,16 @@ class ShadowLayersParent : public PLayersParent,
|
||||
typedef InfallibleTArray<EditReply> EditReplyArray;
|
||||
|
||||
public:
|
||||
ShadowLayersParent(ShadowLayerManager* aManager, ShadowLayersManager* aLayersManager);
|
||||
ShadowLayersParent(ShadowLayerManager* aManager,
|
||||
ShadowLayersManager* aLayersManager,
|
||||
uint64_t aId);
|
||||
~ShadowLayersParent();
|
||||
|
||||
void Destroy();
|
||||
|
||||
ShadowLayerManager* layer_manager() const { return mLayerManager; }
|
||||
|
||||
uint64_t GetId() const { return mId; }
|
||||
ContainerLayer* GetRoot() const { return mRoot; }
|
||||
|
||||
virtual void DestroySharedSurface(gfxSharedImageSurface* aSurface);
|
||||
@ -69,6 +72,11 @@ private:
|
||||
// Hold the root because it might be grafted under various
|
||||
// containers in the "real" layer tree
|
||||
nsRefPtr<ContainerLayer> mRoot;
|
||||
// When this is nonzero, it refers to a layer tree owned by the
|
||||
// compositor thread. It is always true that
|
||||
// mId != 0 => mRoot == null
|
||||
// because the "real tree" is owned by the compositor.
|
||||
uint64_t mId;
|
||||
// When the widget/frame/browser stuff in this process begins its
|
||||
// destruction process, we need to Disconnect() all the currently
|
||||
// live shadow layers, because some of them might be orphaned from
|
||||
|
@ -28,8 +28,19 @@ sync protocol PRenderFrame
|
||||
manages PLayers;
|
||||
|
||||
parent:
|
||||
sync PLayers()
|
||||
returns (LayersBackend backend, int maxTextureSize);
|
||||
/**
|
||||
* Shadow layer trees can be grafted into the parent's in one of
|
||||
* two ways
|
||||
* - direct shadow tree: updates are sent to parent
|
||||
* - indirect: the parent holds a reference (ID) to a shadow tree
|
||||
* that's managed by the compositor. During composition, the
|
||||
* shadow tree is looked up and grafted appropriately
|
||||
*
|
||||
* |id| is set to 0 in the "direct" case, and to a whole number
|
||||
* in the "indirect" case.
|
||||
*/
|
||||
sync PLayers()
|
||||
returns (LayersBackend backend, int32_t maxTextureSize, uint64_t layersId);
|
||||
|
||||
async __delete__();
|
||||
|
||||
|
@ -33,7 +33,8 @@ RenderFrameChild::Destroy()
|
||||
}
|
||||
|
||||
PLayersChild*
|
||||
RenderFrameChild::AllocPLayers(LayerManager::LayersBackend* aBackendType, int* aMaxTextureSize)
|
||||
RenderFrameChild::AllocPLayers(LayerManager::LayersBackend* aBackendType,
|
||||
int* aMaxTextureSize, uint64_t* aId)
|
||||
{
|
||||
return new ShadowLayersChild();
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ public:
|
||||
|
||||
protected:
|
||||
NS_OVERRIDE
|
||||
virtual PLayersChild* AllocPLayers(LayerManager::LayersBackend* aBackendType, int* aMaxTextureSize);
|
||||
virtual PLayersChild* AllocPLayers(LayerManager::LayersBackend* aBackendType,
|
||||
int* aMaxTextureSize, uint64_t* aId);
|
||||
NS_OVERRIDE
|
||||
virtual bool DeallocPLayers(PLayersChild* aLayers);
|
||||
};
|
||||
|
@ -609,25 +609,34 @@ RenderFrameParent::ActorDestroy(ActorDestroyReason why)
|
||||
}
|
||||
|
||||
PLayersParent*
|
||||
RenderFrameParent::AllocPLayers(LayerManager::LayersBackend* aBackendType, int* aMaxTextureSize)
|
||||
RenderFrameParent::AllocPLayers(LayerManager::LayersBackend* aBackendType,
|
||||
int* aMaxTextureSize,
|
||||
uint64_t* aId)
|
||||
{
|
||||
*aBackendType = LayerManager::LAYERS_NONE;
|
||||
*aMaxTextureSize = 0;
|
||||
*aId = 0;
|
||||
|
||||
if (!mFrameLoader || mFrameLoaderDestroyed) {
|
||||
*aBackendType = LayerManager::LAYERS_NONE;
|
||||
*aMaxTextureSize = 0;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsRefPtr<LayerManager> lm =
|
||||
nsContentUtils::LayerManagerForDocument(mFrameLoader->GetOwnerDoc());
|
||||
nsIDocument* doc = mFrameLoader->GetOwnerDoc();
|
||||
nsRefPtr<LayerManager> lm = nsContentUtils::LayerManagerForDocument(doc);
|
||||
ShadowLayerManager* slm = lm->AsShadowManager();
|
||||
if (!slm) {
|
||||
*aBackendType = LayerManager::LAYERS_NONE;
|
||||
*aMaxTextureSize = 0;
|
||||
return nsnull;
|
||||
}
|
||||
*aBackendType = lm->GetBackendType();
|
||||
*aMaxTextureSize = lm->GetMaxTextureSize();
|
||||
return new ShadowLayersParent(slm, this);
|
||||
#if 0 // Enabled in later patch
|
||||
if (CompositorParent::CompositorLoop()) {
|
||||
// Our remote frame will push layers updates to the compositor,
|
||||
// and we'll keep an indirect reference to that tree.
|
||||
*aId = CompositorParent::AllocateLayerTreeId();
|
||||
}
|
||||
#endif
|
||||
return new ShadowLayersParent(slm, this, *aId);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -681,6 +690,13 @@ RenderFrameParent::GetShadowLayers() const
|
||||
static_cast<ShadowLayersParent*>(shadowParents[0]) : nsnull;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
RenderFrameParent::GetLayerTreeId() const
|
||||
{
|
||||
ShadowLayersParent* shadowLayers = GetShadowLayers();
|
||||
return shadowLayers ? shadowLayers->GetId() : 0;
|
||||
}
|
||||
|
||||
ContainerLayer*
|
||||
RenderFrameParent::GetRootLayer() const
|
||||
{
|
||||
|
@ -71,16 +71,18 @@ public:
|
||||
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
|
||||
|
||||
protected:
|
||||
NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
|
||||
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
NS_OVERRIDE virtual PLayersParent* AllocPLayers(LayerManager::LayersBackend* aBackendType,
|
||||
int* aMaxTextureSize);
|
||||
NS_OVERRIDE virtual bool DeallocPLayers(PLayersParent* aLayers);
|
||||
virtual PLayersParent*
|
||||
AllocPLayers(LayerManager::LayersBackend* aBackendType,
|
||||
int* aMaxTextureSize, uint64_t* aLayersId) MOZ_OVERRIDE;
|
||||
virtual bool DeallocPLayers(PLayersParent* aLayers) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
void BuildViewMap();
|
||||
|
||||
ShadowLayersParent* GetShadowLayers() const;
|
||||
uint64_t GetLayerTreeId() const;
|
||||
ContainerLayer* GetRootLayer() const;
|
||||
|
||||
nsRefPtr<nsFrameLoader> mFrameLoader;
|
||||
|
@ -179,9 +179,9 @@ void nsBaseWidget::BaseCreate(nsIWidget *aParent,
|
||||
{
|
||||
static bool gDisableNativeThemeCached = false;
|
||||
if (!gDisableNativeThemeCached) {
|
||||
mozilla::Preferences::AddBoolVarCache(&gDisableNativeTheme,
|
||||
"mozilla.widget.disable-native-theme",
|
||||
gDisableNativeTheme);
|
||||
Preferences::AddBoolVarCache(&gDisableNativeTheme,
|
||||
"mozilla.widget.disable-native-theme",
|
||||
gDisableNativeTheme);
|
||||
gDisableNativeThemeCached = true;
|
||||
}
|
||||
|
||||
@ -879,9 +879,9 @@ void nsBaseWidget::CreateCompositor()
|
||||
PRInt32 maxTextureSize;
|
||||
PLayersChild* shadowManager;
|
||||
if (mUseAcceleratedRendering) {
|
||||
shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL, &maxTextureSize);
|
||||
shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL, 0, &maxTextureSize);
|
||||
} else {
|
||||
shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_BASIC, &maxTextureSize);
|
||||
shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_BASIC, 0, &maxTextureSize);
|
||||
}
|
||||
|
||||
if (shadowManager) {
|
||||
|
Loading…
Reference in New Issue
Block a user