Bug 1345314. P1 - move DeleteOnMainThread() to WMFVideoMFTManager.cpp to discourage the use of nsAutoPtr. r=jya

MozReview-Commit-ID: LxIQcdZtVx7

--HG--
extra : rebase_source : bb413ff39c8a6f0767a3085c6329aee0f7ebe4e2
extra : intermediate-source : 37015a40e525c1192c64dbb5d4bc5cf5fa95ba28
extra : source : e69d2868bfe38092bcc8f6c431439098a4a2afe3
This commit is contained in:
JW Wang 2017-03-07 15:19:29 +08:00
Родитель 7b5a196e57
Коммит eac0286baf
2 изменённых файлов: 23 добавлений и 23 удалений

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

@ -101,29 +101,6 @@ private:
nsCOMPtr<nsIThread> mThread;
};
template<class T>
class DeleteObjectTask: public Runnable {
public:
explicit DeleteObjectTask(nsAutoPtr<T>& aObject)
: Runnable("VideoUtils::DeleteObjectTask")
, mObject(aObject)
{
}
NS_IMETHOD Run() override {
NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
mObject = nullptr;
return NS_OK;
}
private:
nsAutoPtr<T> mObject;
};
template<class T>
void DeleteOnMainThread(nsAutoPtr<T>& aObject) {
nsCOMPtr<nsIRunnable> r = new DeleteObjectTask<T>(aObject);
SystemGroup::Dispatch("VideoUtils::DeleteObjectTask", TaskCategory::Other, r.forget());
}
class MediaResource;
// Estimates the buffered ranges of a MediaResource using a simple

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

@ -71,6 +71,29 @@ const CLSID CLSID_WebmMfVpxDec =
namespace mozilla {
template<class T>
class DeleteObjectTask: public Runnable {
public:
explicit DeleteObjectTask(nsAutoPtr<T>& aObject)
: Runnable("VideoUtils::DeleteObjectTask")
, mObject(aObject)
{
}
NS_IMETHOD Run() override {
NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
mObject = nullptr;
return NS_OK;
}
private:
nsAutoPtr<T> mObject;
};
template<class T>
void DeleteOnMainThread(nsAutoPtr<T>& aObject) {
nsCOMPtr<nsIRunnable> r = new DeleteObjectTask<T>(aObject);
SystemGroup::Dispatch("VideoUtils::DeleteObjectTask", TaskCategory::Other, r.forget());
}
LayersBackend
GetCompositorBackendType(layers::KnowsCompositor* aKnowsCompositor)
{