Bug 1253840 - Remove .ini file as it's no longer necessary by passing on all platform...
[gecko.git] / gfx / ipc / CanvasRenderThread.h
blob08dd6c6d5442dce0b73f8148798c7736a49ca94e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef _include_gfx_ipc_CanvasRenderThread_h__
8 #define _include_gfx_ipc_CanvasRenderThread_h__
10 #include "mozilla/DataMutex.h"
11 #include "mozilla/layers/SynchronousTask.h"
12 #include "mozilla/StaticPtr.h"
13 #include "nsISupportsImpl.h"
14 #include "nsThread.h"
16 namespace mozilla::gfx {
18 class CanvasRenderThread final {
19 NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_DELETE_ON_MAIN_THREAD(
20 CanvasRenderThread)
22 public:
23 /// Can be called from any thread, may return nullptr late in shutdown.
24 static CanvasRenderThread* Get();
26 /// Can only be called from the main thread, expected to be called at most
27 /// once during a process' lifetime.
28 static void Start();
30 /// Can only be called from the main thread.
31 static void ShutDown();
33 /// Can be called from any thread.
34 static bool IsInCanvasRenderThread();
36 /// Can be called from any thread, may return nullptr late in shutdown.
37 static already_AddRefed<nsIThread> GetCanvasRenderThread();
39 private:
40 explicit CanvasRenderThread(RefPtr<nsIThread> aThread);
41 ~CanvasRenderThread();
43 void PostRunnable(already_AddRefed<nsIRunnable> aRunnable);
45 RefPtr<nsIThread> const mThread;
48 } // namespace mozilla::gfx
50 #endif // _include_gfx_ipc_CanvasRenderThread_h__