Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef MOZILLA_GFX_COMPOSITORMANAGERPARENT_H
7 : #define MOZILLA_GFX_COMPOSITORMANAGERPARENT_H
8 :
9 : #include <stdint.h> // for uint32_t
10 : #include "mozilla/Attributes.h" // for override
11 : #include "mozilla/StaticPtr.h" // for StaticRefPtr
12 : #include "mozilla/StaticMutex.h" // for StaticMutex
13 : #include "mozilla/RefPtr.h" // for already_AddRefed
14 : #include "mozilla/layers/PCompositorManagerParent.h"
15 : #include "nsTArray.h" // for AutoTArray
16 :
17 : namespace mozilla {
18 : namespace layers {
19 :
20 : class CompositorBridgeParent;
21 : class CompositorThreadHolder;
22 :
23 : class CompositorManagerParent final : public PCompositorManagerParent
24 : {
25 16 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorManagerParent)
26 :
27 : public:
28 : static already_AddRefed<CompositorManagerParent> CreateSameProcess();
29 : static void Create(Endpoint<PCompositorManagerParent>&& aEndpoint);
30 :
31 : static already_AddRefed<CompositorBridgeParent>
32 : CreateSameProcessWidgetCompositorBridge(CSSToLayoutDeviceScale aScale,
33 : const CompositorOptions& aOptions,
34 : bool aUseExternalSurfaceSize,
35 : const gfx::IntSize& aSurfaceSize);
36 :
37 : void ActorDestroy(ActorDestroyReason aReason) override;
38 :
39 : bool DeallocPCompositorBridgeParent(PCompositorBridgeParent* aActor) override;
40 : PCompositorBridgeParent* AllocPCompositorBridgeParent(const CompositorBridgeOptions& aOpt) override;
41 :
42 : private:
43 : static StaticRefPtr<CompositorManagerParent> sInstance;
44 : static StaticMutex sMutex;
45 :
46 : CompositorManagerParent();
47 : ~CompositorManagerParent() override;
48 :
49 : void Bind(Endpoint<PCompositorManagerParent>&& aEndpoint);
50 :
51 : void DeallocPCompositorManagerParent() override;
52 :
53 : RefPtr<CompositorThreadHolder> mCompositorThreadHolder;
54 :
55 : AutoTArray<RefPtr<CompositorBridgeParent>, 1> mPendingCompositorBridges;
56 : };
57 :
58 : } // namespace layers
59 : } // namespace mozilla
60 :
61 : #endif
|