Bug 1761003 [wpt PR 33324] - Add comment pointing to followup bug, and fix typos...
[gecko.git] / widget / windows / WinCompositorWindowThread.h
blobc1462711ce9e43257e8d7eaff076a01b40a36263
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 widget_windows_WinCompositorWindowThread_h
8 #define widget_windows_WinCompositorWindowThread_h
10 #include "base/thread.h"
11 #include "base/message_loop.h"
13 namespace mozilla {
15 namespace layers {
16 class SynchronousTask;
19 namespace widget {
21 struct WinCompositorWnds {
22 HWND mCompositorWnd;
23 HWND mInitialParentWnd;
24 WinCompositorWnds(HWND aCompositorWnd, HWND aInitialParentWnd)
25 : mCompositorWnd(aCompositorWnd), mInitialParentWnd(aInitialParentWnd) {}
28 class WinCompositorWindowThread final {
29 NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_DELETE_ON_MAIN_THREAD(
30 WinCompositorWindowThread)
32 public:
33 /// Can be called from any thread.
34 static WinCompositorWindowThread* Get();
36 /// Can only be called from the main thread.
37 static void Start();
39 /// Can only be called from the main thread.
40 static void ShutDown();
42 /// Can be called from any thread.
43 static MessageLoop* Loop();
45 /// Can be called from any thread.
46 static bool IsInCompositorWindowThread();
48 /// Can be called from any thread.
49 static WinCompositorWnds CreateCompositorWindow();
51 /// Can be called from any thread.
52 static void DestroyCompositorWindow(WinCompositorWnds aWnds);
54 private:
55 explicit WinCompositorWindowThread(base::Thread* aThread);
56 ~WinCompositorWindowThread();
58 void ShutDownTask(layers::SynchronousTask* aTask);
60 base::Thread* const mThread;
63 } // namespace widget
64 } // namespace mozilla
66 #endif // widget_windows_WinCompositorWindowThread_h