зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
7b5a196e57
Коммит
eac0286baf
|
@ -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)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче