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"
16 class SynchronousTask
;
21 struct WinCompositorWnds
{
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
)
33 /// Can be called from any thread.
34 static WinCompositorWindowThread
* Get();
36 /// Can only be called from the main thread.
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
);
55 explicit WinCompositorWindowThread(base::Thread
* aThread
);
56 ~WinCompositorWindowThread();
58 void ShutDownTask(layers::SynchronousTask
* aTask
);
60 base::Thread
* const mThread
;
64 } // namespace mozilla
66 #endif // widget_windows_WinCompositorWindowThread_h