From 727e68fef6e31d5876e1a8e66ab9f2a8c60ee7d2 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Wed, 16 Oct 2019 02:53:07 +0000 Subject: [PATCH] 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 --- dom/webgpu/thread/WebGPUThreading.cpp | 19 ++++++++----------- dom/webgpu/thread/WebGPUThreading.h | 15 ++++++++------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/dom/webgpu/thread/WebGPUThreading.cpp b/dom/webgpu/thread/WebGPUThreading.cpp index bb5b96dacedc..48664fe94bb1 100644 --- a/dom/webgpu/thread/WebGPUThreading.cpp +++ b/dom/webgpu/thread/WebGPUThreading.cpp @@ -12,12 +12,9 @@ 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() { @@ -35,8 +32,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()); } @@ -45,11 +42,10 @@ 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; @@ -57,6 +53,7 @@ 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 a033c245236e..dd85f78781a9 100644 --- a/dom/webgpu/thread/WebGPUThreading.h +++ b/dom/webgpu/thread/WebGPUThreading.h @@ -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