Bug 1790188 - Fix releasing CompositableRef of mLatestTextureHost r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D157067
This commit is contained in:
sotaro 2022-09-12 03:49:02 +00:00
Родитель 708604622a
Коммит 87a37cfd91
1 изменённых файлов: 15 добавлений и 0 удалений

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

@ -209,6 +209,7 @@ void RemoteTextureMap::KeepTextureDataAliveForTextureHostIfNecessary(
void RemoteTextureMap::UnregisterTextureOwner(
const RemoteTextureOwnerId aOwnerId, const base::ProcessId aForPid) {
UniquePtr<TextureOwner> releasingOwner; // Release outside the mutex
RefPtr<TextureHost> releasingTexture; // Release outside the mutex
{
MutexAutoLock lock(mMutex);
@ -219,6 +220,12 @@ void RemoteTextureMap::UnregisterTextureOwner(
return;
}
if (it->second->mLatestTextureHost) {
// Release CompositableRef in mMutex
releasingTexture = it->second->mLatestTextureHost;
it->second->mLatestTextureHost = nullptr;
}
KeepTextureDataAliveForTextureHostIfNecessary(
lock, it->second->mUsingTextureDataHolders);
@ -233,6 +240,8 @@ void RemoteTextureMap::UnregisterTextureOwners(
const base::ProcessId aForPid) {
std::vector<UniquePtr<TextureOwner>>
releasingOwners; // Release outside the mutex
std::vector<RefPtr<TextureHost>>
releasingTextures; // Release outside the mutex
{
MutexAutoLock lock(mMutex);
@ -244,6 +253,12 @@ void RemoteTextureMap::UnregisterTextureOwners(
continue;
}
if (it->second->mLatestTextureHost) {
// Release CompositableRef in mMutex
releasingTextures.emplace_back(it->second->mLatestTextureHost);
it->second->mLatestTextureHost = nullptr;
}
KeepTextureDataAliveForTextureHostIfNecessary(
lock, it->second->mUsingTextureDataHolders);