Bug 1758188: Remove unneeded mutex from FilterNodeSoftware r=gfx-reviewers,mstange

Differential Revision: https://phabricator.services.mozilla.com/D140404
This commit is contained in:
Randell Jesup 2022-03-04 21:44:29 +00:00
parent 5086768d0c
commit ffaf118a11
2 changed files with 10 additions and 23 deletions

View File

@ -618,19 +618,15 @@ already_AddRefed<DataSourceSurface> FilterNodeSoftware::GetOutput(
IntRect requestedRect;
RefPtr<DataSourceSurface> cachedOutput;
// Lock the cache and retrieve a cached surface if we have one and it can
// Retrieve a cached surface if we have one and it can
// satisfy this request, or else request a rect we will compute and cache
{
MutexAutoLock lock(mCacheMutex);
if (!mCachedRect.Contains(aRect)) {
RequestRect(aRect);
requestedRect = mRequestedRect;
} else {
MOZ_ASSERT(mCachedOutput, "cached rect but no cached output?");
cachedRect = mCachedRect;
cachedOutput = mCachedOutput;
}
if (!mCachedRect.Contains(aRect)) {
RequestRect(aRect);
requestedRect = mRequestedRect;
} else {
MOZ_ASSERT(mCachedOutput, "cached rect but no cached output?");
cachedRect = mCachedRect;
cachedOutput = mCachedOutput;
}
if (!cachedOutput) {
@ -638,8 +634,6 @@ already_AddRefed<DataSourceSurface> FilterNodeSoftware::GetOutput(
cachedOutput = Render(requestedRect);
// Update the cache for future requests
MutexAutoLock lock(mCacheMutex);
mCachedOutput = cachedOutput;
if (!mCachedOutput) {
mCachedRect = IntRect();
@ -710,6 +704,7 @@ void FilterNodeSoftware::RequestInputRect(uint32_t aInputEnumIndex,
}
RefPtr<FilterNodeSoftware> filter = mInputFilters[inputIndex];
MOZ_ASSERT(filter, "missing input");
filter->RequestRect(filter->GetOutputRectInRect(aRect));
}
@ -896,7 +891,6 @@ void FilterNodeSoftware::FilterInvalidated(FilterNodeSoftware* aFilter) {
}
void FilterNodeSoftware::Invalidate() {
MutexAutoLock lock(mCacheMutex);
mCachedOutput = nullptr;
mCachedRect = IntRect();
for (std::vector<FilterInvalidationListener*>::iterator it =
@ -906,8 +900,7 @@ void FilterNodeSoftware::Invalidate() {
}
}
FilterNodeSoftware::FilterNodeSoftware()
: mCacheMutex("FilterNodeSoftware::mCacheMutex") {}
FilterNodeSoftware::FilterNodeSoftware() {}
FilterNodeSoftware::~FilterNodeSoftware() {
MOZ_ASSERT(

View File

@ -203,12 +203,6 @@ class FilterNodeSoftware : public FilterNode,
*/
std::vector<FilterInvalidationListener*> mInvalidationListeners;
/**
* Lock guarding mRequestedRect, mCachedRect, and mCachedOutput. All uses
* of those members must aquire this lock.
*/
Mutex mCacheMutex;
/**
* Stores the rect which we want to render and cache on the next call to
* GetOutput.