Bug 1876536 - Part 2: Remove self refcounts within constructor in ImageBitmap r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D199978
This commit is contained in:
Kagami Sascha Rosylight 2024-02-01 11:03:59 +00:00
Родитель 7b236d5446
Коммит 139143faca
1 изменённых файлов: 2 добавлений и 1 удалений

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

@ -81,7 +81,7 @@ class SendShutdownToWorkerThread : public MainThreadWorkerControlRunnable {
*/
class ImageBitmapShutdownObserver final : public nsIObserver {
public:
explicit ImageBitmapShutdownObserver() {
void Init() {
sShutdownMutex.AssertCurrentThreadOwns();
if (NS_IsMainThread()) {
RegisterObserver();
@ -649,6 +649,7 @@ ImageBitmap::ImageBitmap(nsIGlobalObject* aGlobal, layers::Image* aData,
if (!sShutdownObserver &&
!AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdown)) {
sShutdownObserver = new ImageBitmapShutdownObserver();
sShutdownObserver->Init();
}
if (sShutdownObserver) {
mShutdownRunnable = sShutdownObserver->Track(this);