Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert

CancelWaitForRecycle() does not cancel wait for recycling. It cancels wait for end of usage on host side.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sotaro 2019-06-01 09:37:56 +00:00
Родитель 41de040ecf
Коммит 16ce9c4a30
11 изменённых файлов: 34 добавлений и 32 удалений

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

@ -276,7 +276,7 @@ SurfaceFactory::~SurfaceFactory() {
while (!mRecycleTotalPool.empty()) {
RefPtr<layers::SharedSurfaceTextureClient> tex = *mRecycleTotalPool.begin();
StopRecycling(tex);
tex->CancelWaitForRecycle();
tex->CancelWaitForNotifyNotUsed();
}
MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(),

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

@ -499,7 +499,7 @@ void CanvasClientSharedSurface::OnDetach() { ClearSurfaces(); }
void CanvasClientSharedSurface::ClearSurfaces() {
if (mFront) {
mFront->CancelWaitForRecycle();
mFront->CancelWaitForNotifyNotUsed();
}
mFront = nullptr;
mNewFront = nullptr;

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

@ -793,8 +793,8 @@ void TextureClient::SetAddedToCompositableClient() {
}
}
static void CancelTextureClientRecycle(uint64_t aTextureId,
LayersIPCChannel* aAllocator) {
static void CancelTextureClientNotifyNotUsed(uint64_t aTextureId,
LayersIPCChannel* aAllocator) {
if (!aAllocator) {
return;
}
@ -804,17 +804,17 @@ static void CancelTextureClientRecycle(uint64_t aTextureId,
return;
}
if (MessageLoop::current() == msgLoop) {
aAllocator->CancelWaitForRecycle(aTextureId);
aAllocator->CancelWaitForNotifyNotUsed(aTextureId);
} else {
msgLoop->PostTask(NewRunnableFunction("CancelTextureClientRecycleRunnable",
CancelTextureClientRecycle,
aTextureId, aAllocator));
msgLoop->PostTask(NewRunnableFunction(
"CancelTextureClientNotifyNotUsedRunnable",
CancelTextureClientNotifyNotUsed, aTextureId, aAllocator));
}
}
void TextureClient::CancelWaitForRecycle() {
void TextureClient::CancelWaitForNotifyNotUsed() {
if (GetFlags() & TextureFlags::RECYCLE) {
CancelTextureClientRecycle(mSerial, GetAllocator());
CancelTextureClientNotifyNotUsed(mSerial, GetAllocator());
return;
}
}

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

@ -596,7 +596,7 @@ class TextureClient : public AtomicRefCountedWithFinalize<TextureClient> {
uint64_t GetSerial() const { return mSerial; }
void GPUVideoDesc(SurfaceDescriptorGPUVideo* aOutDesc);
void CancelWaitForRecycle();
void CancelWaitForNotifyNotUsed();
/**
* Set last transaction id of CompositableForwarder.

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

@ -125,7 +125,7 @@ void CompositorBridgeChild::AfterDestroy() {
void CompositorBridgeChild::Destroy() {
// This must not be called from the destructor!
mTexturesWaitingRecycled.clear();
mTexturesWaitingNotifyNotUsed.clear();
// Destroying the layer manager may cause all sorts of things to happen, so
// let's make sure there is still a reference to keep this alive whatever
@ -834,23 +834,23 @@ void CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(
}
aClient->SetLastFwdTransactionId(GetFwdTransactionId());
mTexturesWaitingRecycled.emplace(aClient->GetSerial(), aClient);
mTexturesWaitingNotifyNotUsed.emplace(aClient->GetSerial(), aClient);
}
void CompositorBridgeChild::NotifyNotUsed(uint64_t aTextureId,
uint64_t aFwdTransactionId) {
auto it = mTexturesWaitingRecycled.find(aTextureId);
if (it != mTexturesWaitingRecycled.end()) {
auto it = mTexturesWaitingNotifyNotUsed.find(aTextureId);
if (it != mTexturesWaitingNotifyNotUsed.end()) {
if (aFwdTransactionId < it->second->GetLastFwdTransactionId()) {
// Released on host side, but client already requested newer use texture.
return;
}
mTexturesWaitingRecycled.erase(it);
mTexturesWaitingNotifyNotUsed.erase(it);
}
}
void CompositorBridgeChild::CancelWaitForRecycle(uint64_t aTextureId) {
mTexturesWaitingRecycled.erase(aTextureId);
void CompositorBridgeChild::CancelWaitForNotifyNotUsed(uint64_t aTextureId) {
mTexturesWaitingNotifyNotUsed.erase(aTextureId);
}
TextureClientPool* CompositorBridgeChild::GetTexturePool(

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

@ -176,7 +176,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
*/
void NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId);
void CancelWaitForRecycle(uint64_t aTextureId) override;
void CancelWaitForNotifyNotUsed(uint64_t aTextureId) override;
TextureClientPool* GetTexturePool(KnowsCompositor* aAllocator,
gfx::SurfaceFormat aFormat,
@ -350,7 +350,8 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
* Hold TextureClients refs until end of their usages on host side.
* It defer calling of TextureClient recycle callback.
*/
std::unordered_map<uint64_t, RefPtr<TextureClient>> mTexturesWaitingRecycled;
std::unordered_map<uint64_t, RefPtr<TextureClient>>
mTexturesWaitingNotifyNotUsed;
MessageLoop* mMessageLoop;

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

@ -122,7 +122,7 @@ class ClientIPCAllocator : public ISurfaceAllocator {
virtual MessageLoop* GetMessageLoop() const = 0;
virtual void CancelWaitForRecycle(uint64_t aTextureId) = 0;
virtual void CancelWaitForNotifyNotUsed(uint64_t aTextureId) = 0;
};
/// Methods that are specific to the host/parent side.

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

@ -141,24 +141,24 @@ void ImageBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(
return;
}
aClient->SetLastFwdTransactionId(GetFwdTransactionId());
mTexturesWaitingRecycled.emplace(aClient->GetSerial(), aClient);
mTexturesWaitingNotifyNotUsed.emplace(aClient->GetSerial(), aClient);
}
void ImageBridgeChild::NotifyNotUsed(uint64_t aTextureId,
uint64_t aFwdTransactionId) {
auto it = mTexturesWaitingRecycled.find(aTextureId);
if (it != mTexturesWaitingRecycled.end()) {
auto it = mTexturesWaitingNotifyNotUsed.find(aTextureId);
if (it != mTexturesWaitingNotifyNotUsed.end()) {
if (aFwdTransactionId < it->second->GetLastFwdTransactionId()) {
// Released on host side, but client already requested newer use texture.
return;
}
mTexturesWaitingRecycled.erase(it);
mTexturesWaitingNotifyNotUsed.erase(it);
}
}
void ImageBridgeChild::CancelWaitForRecycle(uint64_t aTextureId) {
void ImageBridgeChild::CancelWaitForNotifyNotUsed(uint64_t aTextureId) {
MOZ_ASSERT(InImageBridgeChildThread());
mTexturesWaitingRecycled.erase(aTextureId);
mTexturesWaitingNotifyNotUsed.erase(aTextureId);
}
// Singleton
@ -247,7 +247,7 @@ ImageBridgeChild::ImageBridgeChild(uint32_t aNamespace)
ImageBridgeChild::~ImageBridgeChild() { delete mTxn; }
void ImageBridgeChild::MarkShutDown() {
mTexturesWaitingRecycled.clear();
mTexturesWaitingNotifyNotUsed.clear();
mCanSend = false;
}

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

@ -289,7 +289,7 @@ class ImageBridgeChild final : public PImageBridgeChild,
*/
void NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId);
void CancelWaitForRecycle(uint64_t aTextureId) override;
void CancelWaitForNotifyNotUsed(uint64_t aTextureId) override;
bool DestroyInTransaction(PTextureChild* aTexture) override;
bool DestroyInTransaction(const CompositableHandle& aHandle);
@ -394,7 +394,8 @@ class ImageBridgeChild final : public PImageBridgeChild,
* Hold TextureClients refs until end of their usages on host side.
* It defer calling of TextureClient recycle callback.
*/
std::unordered_map<uint64_t, RefPtr<TextureClient>> mTexturesWaitingRecycled;
std::unordered_map<uint64_t, RefPtr<TextureClient>>
mTexturesWaitingNotifyNotUsed;
/**
* Mapping from async compositable IDs to image containers.

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

@ -52,7 +52,7 @@ class LayersIPCChannel : public LayersIPCActor,
return nullptr;
}
virtual void CancelWaitForRecycle(uint64_t aTextureId) = 0;
virtual void CancelWaitForNotifyNotUsed(uint64_t aTextureId) = 0;
virtual wr::MaybeExternalImageId GetNextExternalImageId() {
return Nothing();

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

@ -55,7 +55,7 @@ class VideoBridgeChild final : public PVideoBridgeChild,
// ClientIPCAllocator
base::ProcessId GetParentPid() const override { return OtherPid(); }
MessageLoop* GetMessageLoop() const override { return mMessageLoop; }
void CancelWaitForRecycle(uint64_t aTextureId) override {
void CancelWaitForNotifyNotUsed(uint64_t aTextureId) override {
MOZ_ASSERT(false, "NO RECYCLING HERE");
}