Backed out changeset 71d5a7f29d05 (bug 1586396) for breaking the wpts. CLOSED TREE

This commit is contained in:
Cosmin Sabou 2019-10-16 08:12:32 +03:00
Родитель 962e9e53a9
Коммит 76d4c77ef9
2 изменённых файлов: 18 добавлений и 16 удалений

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

@ -12,9 +12,12 @@ namespace webgpu {
static StaticRefPtr<WebGPUThreading> sWebGPUThread;
WebGPUThreading::WebGPUThreading(base::Thread* aThread) : mThread(aThread) {}
WebGPUThreading::WebGPUThreading(base::Thread* aThread)
: mThread(aThread) {}
WebGPUThreading::~WebGPUThreading() { delete mThread; }
WebGPUThreading::~WebGPUThreading() {
delete mThread;
}
// static
void WebGPUThreading::Start() {
@ -32,8 +35,8 @@ void WebGPUThreading::Start() {
sWebGPUThread = new WebGPUThreading(thread);
const auto fnInit = []() {};
RefPtr<Runnable> runnable =
NS_NewRunnableFunction("WebGPUThreading fnInit", fnInit);
RefPtr<Runnable> runnable = NS_NewRunnableFunction(
"WebGPUThreading fnInit", fnInit);
sWebGPUThread->GetLoop()->PostTask(runnable.forget());
}
@ -42,10 +45,11 @@ void WebGPUThreading::ShutDown() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(sWebGPUThread);
const auto fnExit = []() {};
const auto fnExit = []() {
};
RefPtr<Runnable> runnable =
NS_NewRunnableFunction("WebGPUThreading fnExit", fnExit);
RefPtr<Runnable> runnable = NS_NewRunnableFunction(
"WebGPUThreading fnExit", fnExit);
sWebGPUThread->GetLoop()->PostTask(runnable.forget());
sWebGPUThread = nullptr;
@ -53,7 +57,6 @@ void WebGPUThreading::ShutDown() {
// static
MessageLoop* WebGPUThreading::GetLoop() {
MOZ_ASSERT(NS_IsMainThread());
return sWebGPUThread ? sWebGPUThread->mThread->message_loop() : nullptr;
}

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

@ -8,17 +8,16 @@
#define MOZILLA_WEBGPU_THREADING_H
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"
#include "base/thread.h" // for Thread
#include "base/thread.h" // for Thread
#include "mozilla/layers/SynchronousTask.h"
namespace mozilla {
namespace webgpu {
class WebGPUThreading final {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(
WebGPUThreading)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(WebGPUThreading)
public:
public:
/// Can only be called from the main thread.
static void Start();
@ -29,14 +28,14 @@ class WebGPUThreading final {
/// the threading is not initialized.
static MessageLoop* GetLoop();
private:
private:
explicit WebGPUThreading(base::Thread* aThread);
~WebGPUThreading();
base::Thread* const mThread;
};
} // namespace webgpu
} // namespace mozilla
}
}
#endif // MOZILLA_WEBGPU_THREADING_H
#endif // MOZILLA_WEBGPU_THREADING_H