Move async compositable ID allocation to ImageBridgeChild. (bug 1325784 part 3, r=nical)

This commit is contained in:
David Anderson 2017-01-04 10:19:29 -05:00
Родитель e8efc823bc
Коммит 2d302f4637
5 изменённых файлов: 22 добавлений и 21 удалений

Просмотреть файл

@ -380,7 +380,8 @@ ImageBridgeChild::Connect(CompositableClient* aCompositable,
MOZ_ASSERT(InImageBridgeChildThread());
MOZ_ASSERT(CanSend());
uint64_t id = 0;
static uint64_t sNextID = 1;
uint64_t id = sNextID++;
PImageContainerChild* imageContainerChild = nullptr;
if (aImageContainer)
@ -388,7 +389,8 @@ ImageBridgeChild::Connect(CompositableClient* aCompositable,
PCompositableChild* child =
SendPCompositableConstructor(aCompositable->GetTextureInfo(),
imageContainerChild, &id);
id,
imageContainerChild);
if (!child) {
return;
}
@ -397,7 +399,8 @@ ImageBridgeChild::Connect(CompositableClient* aCompositable,
PCompositableChild*
ImageBridgeChild::AllocPCompositableChild(const TextureInfo& aInfo,
PImageContainerChild* aChild, uint64_t* aID)
const uint64_t& aID,
PImageContainerChild* aChild)
{
MOZ_ASSERT(CanSend());
return AsyncCompositableChild::CreateActor();

Просмотреть файл

@ -170,7 +170,8 @@ public:
virtual base::ProcessId GetParentPid() const override { return OtherPid(); }
PCompositableChild* AllocPCompositableChild(const TextureInfo& aInfo,
PImageContainerChild* aChild, uint64_t* aID) override;
const uint64_t& aID,
PImageContainerChild* aChild) override;
bool DeallocPCompositableChild(PCompositableChild* aActor) override;
virtual PTextureChild*

Просмотреть файл

@ -238,26 +238,22 @@ mozilla::ipc::IPCResult ImageBridgeParent::RecvWillClose()
return IPC_OK();
}
static uint64_t GenImageContainerID() {
static uint64_t sNextImageID = 1;
++sNextImageID;
return sNextImageID;
}
PCompositableParent*
ImageBridgeParent::AllocPCompositableParent(const TextureInfo& aInfo,
PImageContainerParent* aImageContainer,
uint64_t* aID)
const uint64_t& aID,
PImageContainerParent* aImageContainer)
{
PCompositableParent* actor = CompositableHost::CreateIPDLActor(this, aInfo, aImageContainer);
if (mCompositables.find(aID) != mCompositables.end()) {
NS_ERROR("Async compositable ID already exists");
return actor;
}
CompositableHost* host = CompositableHost::FromIPDLActor(actor);
uint64_t id = GenImageContainerID();
host->SetAsyncID(id);
mCompositables[id] = host;
host->SetAsyncID(aID);
mCompositables[aID] = host;
*aID = id;
return actor;
}

Просмотреть файл

@ -79,8 +79,8 @@ public:
const uint64_t& aFwdTransactionId) override;
PCompositableParent* AllocPCompositableParent(const TextureInfo& aInfo,
PImageContainerParent* aImageContainer,
uint64_t*) override;
const uint64_t& aID,
PImageContainerParent* aImageContainer) override;
bool DeallocPCompositableParent(PCompositableParent* aActor) override;
virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData,

Просмотреть файл

@ -55,8 +55,9 @@ parent:
// before sending closing the channel.
sync WillClose();
sync PCompositable(TextureInfo aInfo,
nullable PImageContainer aImageContainer) returns (uint64_t id);
async PCompositable(TextureInfo aInfo,
uint64_t aId,
nullable PImageContainer aImageContainer);
async PTexture(SurfaceDescriptor aSharedData, LayersBackend aBackend, TextureFlags aTextureFlags, uint64_t aSerial);
async PMediaSystemResourceManager();
async PImageContainer();