mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1335321 - stylo: Do CachedBorderImageData::PurgeCachedImages work on the main thread. r=bholley
MozReview-Commit-ID: 82vKTooB2fh --HG-- extra : rebase_source : 7a4cfc44987a499738f6d8f79cf107393c3fca0c
This commit is contained in:
parent
7f072468f4
commit
8856103bc6
@ -2054,10 +2054,29 @@ CachedBorderImageData::GetCachedSVGViewportSize()
|
||||
return mCachedSVGViewportSize;
|
||||
}
|
||||
|
||||
struct PurgeCachedImagesTask : mozilla::Runnable
|
||||
{
|
||||
NS_IMETHOD Run() final
|
||||
{
|
||||
mSubImages.Clear();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMArray<imgIContainer> mSubImages;
|
||||
};
|
||||
|
||||
void
|
||||
CachedBorderImageData::PurgeCachedImages()
|
||||
{
|
||||
mSubImages.Clear();
|
||||
if (ServoStyleSet::IsInServoTraversal()) {
|
||||
RefPtr<PurgeCachedImagesTask> task = new PurgeCachedImagesTask();
|
||||
task->mSubImages.SwapElements(mSubImages);
|
||||
// This will run the task immediately if we're already on the main thread,
|
||||
// but that is fine.
|
||||
NS_DispatchToMainThread(task.forget());
|
||||
} else {
|
||||
mSubImages.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user