Revert "Bug 1989517 - Ensure DrawTarget removed from RecordedTextureDestruction playback. r=aosmond, a=dmeehan" for causing build failures
This reverts commit 7ea9fd74e4.
This commit is contained in:
committed by
dmeehan@mozilla.com
parent
ce0b8a6e42
commit
a76aca3306
@@ -533,9 +533,7 @@ bool CanvasTranslator::TryDrawTargetWebglFallback(
|
||||
CreateFallbackDrawTarget(info.mRefPtr, aTextureOwnerId,
|
||||
aWebgl->GetSize(), aWebgl->GetFormat())) {
|
||||
bool success = aWebgl->CopyToFallback(dt);
|
||||
if (info.mRefPtr) {
|
||||
AddDrawTarget(info.mRefPtr, dt);
|
||||
}
|
||||
AddDrawTarget(info.mRefPtr, dt);
|
||||
return success;
|
||||
}
|
||||
return false;
|
||||
@@ -1086,18 +1084,16 @@ void CanvasTranslator::CacheSnapshotShmem(
|
||||
if (gfx::DrawTargetWebgl* webgl = GetDrawTargetWebgl(aTextureOwnerId)) {
|
||||
if (auto shmemHandle = webgl->TakeShmemHandle()) {
|
||||
// Lock the DT so that it doesn't get removed while shmem is in transit.
|
||||
AddTextureKeepAlive(aTextureOwnerId);
|
||||
mTextureInfo[aTextureOwnerId].mLocked++;
|
||||
nsCOMPtr<nsIThread> thread =
|
||||
gfx::CanvasRenderThread::GetCanvasRenderThread();
|
||||
RefPtr<CanvasTranslator> translator = this;
|
||||
SendSnapshotShmem(aTextureOwnerId, std::move(shmemHandle))
|
||||
->Then(
|
||||
thread, __func__,
|
||||
[=](bool) {
|
||||
translator->RemoveTextureKeepAlive(aTextureOwnerId);
|
||||
},
|
||||
[=](bool) { translator->RemoveTexture(aTextureOwnerId); },
|
||||
[=](ipc::ResponseRejectReason) {
|
||||
translator->RemoveTextureKeepAlive(aTextureOwnerId);
|
||||
translator->RemoveTexture(aTextureOwnerId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1271,9 +1267,7 @@ already_AddRefed<gfx::DrawTarget> CanvasTranslator::CreateDrawTarget(
|
||||
dt = CreateFallbackDrawTarget(aRefPtr, aTextureOwnerId, aSize, aFormat);
|
||||
}
|
||||
|
||||
if (dt && aRefPtr) {
|
||||
AddDrawTarget(aRefPtr, dt);
|
||||
}
|
||||
AddDrawTarget(aRefPtr, dt);
|
||||
return dt.forget();
|
||||
}
|
||||
|
||||
@@ -1296,23 +1290,9 @@ void CanvasTranslator::NotifyTextureDestruction(
|
||||
Unused << SendNotifyTextureDestruction(aTextureOwnerId);
|
||||
}
|
||||
|
||||
void CanvasTranslator::AddTextureKeepAlive(const RemoteTextureOwnerId& aId) {
|
||||
auto result = mTextureInfo.find(aId);
|
||||
if (result == mTextureInfo.end()) {
|
||||
return;
|
||||
}
|
||||
auto& info = result->second;
|
||||
++info.mKeepAlive;
|
||||
}
|
||||
|
||||
void CanvasTranslator::RemoveTextureKeepAlive(const RemoteTextureOwnerId& aId) {
|
||||
RemoveTexture(aId, 0, 0, false);
|
||||
}
|
||||
|
||||
void CanvasTranslator::RemoveTexture(const RemoteTextureOwnerId aTextureOwnerId,
|
||||
RemoteTextureTxnType aTxnType,
|
||||
RemoteTextureTxnId aTxnId,
|
||||
bool aFinalize) {
|
||||
RemoteTextureTxnId aTxnId) {
|
||||
// Don't erase the texture if still in use
|
||||
auto result = mTextureInfo.find(aTextureOwnerId);
|
||||
if (result == mTextureInfo.end()) {
|
||||
@@ -1322,17 +1302,10 @@ void CanvasTranslator::RemoveTexture(const RemoteTextureOwnerId aTextureOwnerId,
|
||||
if (mRemoteTextureOwner && aTxnType && aTxnId) {
|
||||
mRemoteTextureOwner->WaitForTxn(aTextureOwnerId, aTxnType, aTxnId);
|
||||
}
|
||||
// Remove the DrawTarget only if this is being called from a recorded event
|
||||
// or if there are no remaining keepalives. If this is being called only to
|
||||
// remove a keepalive without forcing removal, then the DrawTarget is still
|
||||
// being used by the recording.
|
||||
if ((aFinalize || info.mKeepAlive <= 1) && info.mRefPtr) {
|
||||
RemoveDrawTarget(info.mRefPtr);
|
||||
info.mRefPtr = ReferencePtr();
|
||||
}
|
||||
if (--info.mKeepAlive > 0) {
|
||||
if (--info.mLocked > 0) {
|
||||
return;
|
||||
}
|
||||
RemoveDrawTarget(info.mRefPtr);
|
||||
if (info.mTextureData) {
|
||||
if (info.mFallbackDrawTarget) {
|
||||
info.mTextureData->ReturnDrawTarget(info.mFallbackDrawTarget.forget());
|
||||
|
||||
@@ -210,8 +210,8 @@ class CanvasTranslator final : public gfx::InlineTranslator,
|
||||
* @param aTextureOwnerId the texture ID to remove
|
||||
*/
|
||||
void RemoveTexture(const RemoteTextureOwnerId aTextureOwnerId,
|
||||
RemoteTextureTxnType aTxnType, RemoteTextureTxnId aTxnId,
|
||||
bool aFinalize = true);
|
||||
RemoteTextureTxnType aTxnType = 0,
|
||||
RemoteTextureTxnId aTxnId = 0);
|
||||
|
||||
bool LockTexture(const RemoteTextureOwnerId aTextureOwnerId, OpenMode aMode,
|
||||
bool aInvalidContents = false);
|
||||
@@ -563,7 +563,7 @@ class CanvasTranslator final : public gfx::InlineTranslator,
|
||||
RefPtr<gfx::DrawTarget> mFallbackDrawTarget;
|
||||
bool mNotifiedRequiresRefresh = false;
|
||||
// Ref-count of how active uses of the DT. Avoids deletion when locked.
|
||||
int32_t mKeepAlive = 1;
|
||||
int32_t mLocked = 1;
|
||||
OpenMode mTextureLockMode = OpenMode::OPEN_NONE;
|
||||
|
||||
gfx::DrawTargetWebgl* GetDrawTargetWebgl(
|
||||
@@ -572,10 +572,6 @@ class CanvasTranslator final : public gfx::InlineTranslator,
|
||||
std::unordered_map<RemoteTextureOwnerId, TextureInfo,
|
||||
RemoteTextureOwnerId::HashFn>
|
||||
mTextureInfo;
|
||||
|
||||
void AddTextureKeepAlive(const RemoteTextureOwnerId& aId);
|
||||
void RemoveTextureKeepAlive(const RemoteTextureOwnerId& aId);
|
||||
|
||||
nsRefPtrHashtable<nsPtrHashKey<void>, gfx::DataSourceSurface> mDataSurfaces;
|
||||
gfx::ReferencePtr mMappedSurface;
|
||||
UniquePtr<gfx::DataSourceSurface::ScopedMap> mPreparedMap;
|
||||
|
||||
Reference in New Issue
Block a user