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()) { while (!mRecycleTotalPool.empty()) {
RefPtr<layers::SharedSurfaceTextureClient> tex = *mRecycleTotalPool.begin(); RefPtr<layers::SharedSurfaceTextureClient> tex = *mRecycleTotalPool.begin();
StopRecycling(tex); StopRecycling(tex);
tex->CancelWaitForRecycle(); tex->CancelWaitForNotifyNotUsed();
} }
MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(), MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(),

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

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

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

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

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

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

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

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

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

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

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

@ -122,7 +122,7 @@ class ClientIPCAllocator : public ISurfaceAllocator {
virtual MessageLoop* GetMessageLoop() const = 0; 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. /// Methods that are specific to the host/parent side.

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

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

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

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

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

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

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

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