Bug 1586396 - Formatting fixes in WebGPUThreading

follow-up to D48229

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

--HG--
extra : rebase_source : a8d4a2c6a797c8b930edc61f87768731a5fba9ae
extra : source : 71d5a7f29d054c17bd35868be6463353626a3869
This commit is contained in:
Dzmitry Malyshau 2019-10-16 02:53:07 +00:00
Родитель ee3842300e
Коммит 727e68fef6
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