Bug 1586396 - Formatting fixes in WebGPUThreading

follow-up to D48229

Differential Revision: https://phabricator.services.mozilla.com/D49367

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dzmitry Malyshau 2019-10-16 02:53:07 +00:00
Родитель f072f15267
Коммит e3328f020c
2 изменённых файлов: 16 добавлений и 18 удалений

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

@ -12,12 +12,9 @@ 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() {
@ -35,8 +32,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());
}
@ -45,11 +42,10 @@ 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;
@ -57,6 +53,7 @@ void WebGPUThreading::ShutDown() {
// static
MessageLoop* WebGPUThreading::GetLoop() {
MOZ_ASSERT(NS_IsMainThread());
return sWebGPUThread ? sWebGPUThread->mThread->message_loop() : nullptr;
}

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

@ -8,16 +8,17 @@
#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();
@ -28,14 +29,14 @@ public:
/// 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