gfx/layers/ipc/LayerTransactionChild.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:5b7eaf53ed48
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8 #ifndef MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
9 #define MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
10
11 #include <stdint.h> // for uint32_t
12 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE
13 #include "mozilla/ipc/ProtocolUtils.h"
14 #include "mozilla/layers/PLayerTransactionChild.h"
15 #include "mozilla/RefPtr.h"
16
17 namespace mozilla {
18
19 namespace layout {
20 class RenderFrameChild;
21 }
22
23 namespace layers {
24
25 class LayerTransactionChild : public PLayerTransactionChild
26 {
27 public:
28 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LayerTransactionChild)
29 /**
30 * Clean this up, finishing with Send__delete__().
31 *
32 * It is expected (checked with an assert) that all shadow layers
33 * created by this have already been destroyed and
34 * Send__delete__()d by the time this method is called.
35 */
36 void Destroy();
37
38 bool IPCOpen() const { return mIPCOpen; }
39
40 protected:
41 LayerTransactionChild()
42 : mIPCOpen(false)
43 {}
44 ~LayerTransactionChild() { }
45
46 virtual PGrallocBufferChild*
47 AllocPGrallocBufferChild(const IntSize&,
48 const uint32_t&, const uint32_t&,
49 MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
50 virtual bool
51 DeallocPGrallocBufferChild(PGrallocBufferChild* actor) MOZ_OVERRIDE;
52
53 virtual PLayerChild* AllocPLayerChild() MOZ_OVERRIDE;
54 virtual bool DeallocPLayerChild(PLayerChild* actor) MOZ_OVERRIDE;
55
56 virtual PCompositableChild* AllocPCompositableChild(const TextureInfo& aInfo) MOZ_OVERRIDE;
57 virtual bool DeallocPCompositableChild(PCompositableChild* actor) MOZ_OVERRIDE;
58
59 virtual PTextureChild* AllocPTextureChild(const SurfaceDescriptor& aSharedData,
60 const TextureFlags& aFlags) MOZ_OVERRIDE;
61 virtual bool DeallocPTextureChild(PTextureChild* actor) MOZ_OVERRIDE;
62
63 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
64
65 void AddIPDLReference() {
66 MOZ_ASSERT(mIPCOpen == false);
67 mIPCOpen = true;
68 AddRef();
69 }
70 void ReleaseIPDLReference() {
71 MOZ_ASSERT(mIPCOpen == true);
72 mIPCOpen = false;
73 Release();
74 }
75 friend class CompositorChild;
76 friend class layout::RenderFrameChild;
77
78 bool mIPCOpen;
79 };
80
81 } // namespace layers
82 } // namespace mozilla
83
84 #endif // MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H

mercurial