From 76d4c77ef940245ce130f8d21b308f18286a1cf9 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Wed, 16 Oct 2019 08:12:32 +0300 Subject: [PATCH] Backed out changeset 71d5a7f29d05 (bug 1586396) for breaking the wpts. CLOSED TREE --- dom/webgpu/thread/WebGPUThreading.cpp | 19 +++++++++++-------- dom/webgpu/thread/WebGPUThreading.h | 15 +++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/dom/webgpu/thread/WebGPUThreading.cpp b/dom/webgpu/thread/WebGPUThreading.cpp index 48664fe94bb1..bb5b96dacedc 100644 --- a/dom/webgpu/thread/WebGPUThreading.cpp +++ b/dom/webgpu/thread/WebGPUThreading.cpp @@ -12,9 +12,12 @@ namespace webgpu { static StaticRefPtr 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 = - NS_NewRunnableFunction("WebGPUThreading fnInit", fnInit); + RefPtr 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 = - NS_NewRunnableFunction("WebGPUThreading fnExit", fnExit); + RefPtr 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; } diff --git a/dom/webgpu/thread/WebGPUThreading.h b/dom/webgpu/thread/WebGPUThreading.h index dd85f78781a9..a033c245236e 100644 --- a/dom/webgpu/thread/WebGPUThreading.h +++ b/dom/webgpu/thread/WebGPUThreading.h @@ -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