mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-03 04:52:54 +00:00
Bug 1360717 - Make WebRenderCompositableHolder could generate WrImageKey r=nical
This commit is contained in:
parent
5d5cdc518c
commit
38717ce0a5
@ -1612,7 +1612,8 @@ CompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipel
|
|||||||
RefPtr<widget::CompositorWidget> widget = mWidget;
|
RefPtr<widget::CompositorWidget> widget = mWidget;
|
||||||
RefPtr<wr::WebRenderAPI> api = wr::WebRenderAPI::Create(
|
RefPtr<wr::WebRenderAPI> api = wr::WebRenderAPI::Create(
|
||||||
gfxPrefs::WebRenderProfilerEnabled(), this, Move(widget), aSize);
|
gfxPrefs::WebRenderProfilerEnabled(), this, Move(widget), aSize);
|
||||||
RefPtr<WebRenderCompositableHolder> holder = new WebRenderCompositableHolder();
|
RefPtr<WebRenderCompositableHolder> holder =
|
||||||
|
new WebRenderCompositableHolder(WebRenderBridgeParent::AllocIdNameSpace());
|
||||||
MOZ_ASSERT(api); // TODO have a fallback
|
MOZ_ASSERT(api); // TODO have a fallback
|
||||||
api->SetRootPipeline(aPipelineId);
|
api->SetRootPipeline(aPipelineId);
|
||||||
mWrBridge = new WebRenderBridgeParent(this, aPipelineId, mWidget, nullptr, Move(api), Move(holder));
|
mWrBridge = new WebRenderBridgeParent(this, aPipelineId, mWidget, nullptr, Move(api), Move(holder));
|
||||||
|
@ -119,7 +119,7 @@ WebRenderBridgeParent::WebRenderBridgeParent(CompositorBridgeParentBase* aCompos
|
|||||||
, mChildLayerObserverEpoch(0)
|
, mChildLayerObserverEpoch(0)
|
||||||
, mParentLayerObserverEpoch(0)
|
, mParentLayerObserverEpoch(0)
|
||||||
, mWrEpoch(0)
|
, mWrEpoch(0)
|
||||||
, mIdNameSpace(++sIdNameSpace)
|
, mIdNameSpace(AllocIdNameSpace())
|
||||||
, mPaused(false)
|
, mPaused(false)
|
||||||
, mDestroyed(false)
|
, mDestroyed(false)
|
||||||
{
|
{
|
||||||
|
@ -165,6 +165,10 @@ public:
|
|||||||
void UpdateAPZ();
|
void UpdateAPZ();
|
||||||
const WebRenderScrollData& GetScrollData() const;
|
const WebRenderScrollData& GetScrollData() const;
|
||||||
|
|
||||||
|
static uint32_t AllocIdNameSpace() {
|
||||||
|
return ++sIdNameSpace;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~WebRenderBridgeParent();
|
virtual ~WebRenderBridgeParent();
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@ using namespace gfx;
|
|||||||
|
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
WebRenderCompositableHolder::WebRenderCompositableHolder()
|
WebRenderCompositableHolder::WebRenderCompositableHolder(uint32_t aIdNamespace)
|
||||||
|
: mIdNamespace(aIdNamespace)
|
||||||
|
, mResourceId(0)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(WebRenderCompositableHolder);
|
MOZ_COUNT_CTOR(WebRenderCompositableHolder);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class WebRenderCompositableHolder final
|
|||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderCompositableHolder)
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderCompositableHolder)
|
||||||
|
|
||||||
explicit WebRenderCompositableHolder();
|
explicit WebRenderCompositableHolder(uint32_t aIdNamespace);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~WebRenderCompositableHolder();
|
~WebRenderCompositableHolder();
|
||||||
@ -59,6 +59,16 @@ public:
|
|||||||
return mCompositeUntilTime;
|
return mCompositeUntilTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t GetNextResourceId() { return ++mResourceId; }
|
||||||
|
uint32_t GetNamespace() { return mIdNamespace; }
|
||||||
|
WrImageKey GetImageKey()
|
||||||
|
{
|
||||||
|
WrImageKey key;
|
||||||
|
key.mNamespace = GetNamespace();
|
||||||
|
key.mHandle = GetNextResourceId();
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct ForwardingTextureHost {
|
struct ForwardingTextureHost {
|
||||||
@ -75,6 +85,8 @@ private:
|
|||||||
std::queue<ForwardingTextureHost> mTextureHosts;
|
std::queue<ForwardingTextureHost> mTextureHosts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint32_t mIdNamespace;
|
||||||
|
uint32_t mResourceId;
|
||||||
nsClassHashtable<nsUint64HashKey, PipelineTexturesHolder> mPipelineTexturesHolders;
|
nsClassHashtable<nsUint64HashKey, PipelineTexturesHolder> mPipelineTexturesHolders;
|
||||||
|
|
||||||
// Render time for the current composition.
|
// Render time for the current composition.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user