/work/obj-fuzz/dist/include/mozilla/layers/LayerTransactionChild.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #ifndef MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H |
8 | | #define MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H |
9 | | |
10 | | #include <stdint.h> // for uint32_t |
11 | | #include "mozilla/Attributes.h" // for override |
12 | | #include "mozilla/ipc/ProtocolUtils.h" |
13 | | #include "mozilla/layers/PLayerTransactionChild.h" |
14 | | #include "mozilla/RefPtr.h" |
15 | | |
16 | | namespace mozilla { |
17 | | |
18 | | namespace layout { |
19 | | class RenderFrameChild; |
20 | | } // namespace layout |
21 | | |
22 | | namespace layers { |
23 | | |
24 | | class ShadowLayerForwarder; |
25 | | |
26 | | class LayerTransactionChild : public PLayerTransactionChild |
27 | | { |
28 | | public: |
29 | | NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LayerTransactionChild) |
30 | | /** |
31 | | * Clean this up, finishing with SendShutDown() which will cause __delete__ |
32 | | * to be sent from the parent side. |
33 | | * |
34 | | * It is expected (checked with an assert) that all shadow layers |
35 | | * created by this have already been destroyed and |
36 | | * Send__delete__()d by the time this method is called. |
37 | | */ |
38 | | void Destroy(); |
39 | | |
40 | 0 | bool IPCOpen() const { return mIPCOpen && !mDestroyed; } |
41 | 0 | bool IsDestroyed() const { return mDestroyed; } |
42 | | |
43 | | void SetForwarder(ShadowLayerForwarder* aForwarder) |
44 | 0 | { |
45 | 0 | mForwarder = aForwarder; |
46 | 0 | } |
47 | | |
48 | 0 | LayersId GetId() const { return mId; } |
49 | | |
50 | 0 | void MarkDestroyed() { |
51 | 0 | mDestroyed = true; |
52 | 0 | } |
53 | | |
54 | | protected: |
55 | | explicit LayerTransactionChild(const LayersId& aId) |
56 | | : mForwarder(nullptr) |
57 | | , mIPCOpen(false) |
58 | | , mDestroyed(false) |
59 | | , mId(aId) |
60 | 0 | {} |
61 | 0 | ~LayerTransactionChild() { } |
62 | | |
63 | | void ActorDestroy(ActorDestroyReason why) override; |
64 | | |
65 | 0 | void AddIPDLReference() { |
66 | 0 | MOZ_ASSERT(mIPCOpen == false); |
67 | 0 | mIPCOpen = true; |
68 | 0 | AddRef(); |
69 | 0 | } |
70 | 0 | void ReleaseIPDLReference() { |
71 | 0 | MOZ_ASSERT(mIPCOpen == true); |
72 | 0 | mIPCOpen = false; |
73 | 0 | Release(); |
74 | 0 | } |
75 | | friend class CompositorBridgeChild; |
76 | | friend class layout::RenderFrameChild; |
77 | | |
78 | | ShadowLayerForwarder* mForwarder; |
79 | | bool mIPCOpen; |
80 | | bool mDestroyed; |
81 | | LayersId mId; |
82 | | }; |
83 | | |
84 | | } // namespace layers |
85 | | } // namespace mozilla |
86 | | |
87 | | #endif // MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H |