Bug 1411803 - ensure MediaCache is deleted on the main thread.
MozReview-Commit-ID: 4JzTyyPF1uT
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -21,16 +21,17 @@
#include "mozilla/StaticPtr.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Telemetry.h"
#include "nsContentUtils.h"
#include "nsIObserverService.h"
#include "nsIPrincipal.h"
#include "nsISeekableStream.h"
#include "nsPrintfCString.h"
+#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
#include "prio.h"
#include <algorithm>
namespace mozilla {
#undef LOG
#undef LOGI
@@ -1533,16 +1534,20 @@ public:
: Runnable("MediaCache::UpdateEvent")
, mMediaCache(aMediaCache)
{
}
NS_IMETHOD Run() override
{
mMediaCache->Update();
+ // Ensure MediaCache is deleted on the main thread.
+ NS_ProxyRelease("UpdateEvent::mMediaCache",
+ SystemGroup::EventTargetFor(mozilla::TaskCategory::Other),
+ mMediaCache.forget());
return NS_OK;
}
private:
RefPtr<MediaCache> mMediaCache;
};
void