gfx/layers/ipc/LayerTransactionChild.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/ipc/LayerTransactionChild.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
    1.12 +#define MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
    1.13 +
    1.14 +#include <stdint.h>                     // for uint32_t
    1.15 +#include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
    1.16 +#include "mozilla/ipc/ProtocolUtils.h"
    1.17 +#include "mozilla/layers/PLayerTransactionChild.h"
    1.18 +#include "mozilla/RefPtr.h"
    1.19 +
    1.20 +namespace mozilla {
    1.21 +
    1.22 +namespace layout {
    1.23 +class RenderFrameChild;
    1.24 +}
    1.25 +
    1.26 +namespace layers {
    1.27 +
    1.28 +class LayerTransactionChild : public PLayerTransactionChild
    1.29 +{
    1.30 +public:
    1.31 +  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LayerTransactionChild)
    1.32 +  /**
    1.33 +   * Clean this up, finishing with Send__delete__().
    1.34 +   *
    1.35 +   * It is expected (checked with an assert) that all shadow layers
    1.36 +   * created by this have already been destroyed and
    1.37 +   * Send__delete__()d by the time this method is called.
    1.38 +   */
    1.39 +  void Destroy();
    1.40 +
    1.41 +  bool IPCOpen() const { return mIPCOpen; }
    1.42 +
    1.43 +protected:
    1.44 +  LayerTransactionChild()
    1.45 +    : mIPCOpen(false)
    1.46 +  {}
    1.47 +  ~LayerTransactionChild() { }
    1.48 +
    1.49 +  virtual PGrallocBufferChild*
    1.50 +  AllocPGrallocBufferChild(const IntSize&,
    1.51 +                           const uint32_t&, const uint32_t&,
    1.52 +                           MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
    1.53 +  virtual bool
    1.54 +  DeallocPGrallocBufferChild(PGrallocBufferChild* actor) MOZ_OVERRIDE;
    1.55 +
    1.56 +  virtual PLayerChild* AllocPLayerChild() MOZ_OVERRIDE;
    1.57 +  virtual bool DeallocPLayerChild(PLayerChild* actor) MOZ_OVERRIDE;
    1.58 +
    1.59 +  virtual PCompositableChild* AllocPCompositableChild(const TextureInfo& aInfo) MOZ_OVERRIDE;
    1.60 +  virtual bool DeallocPCompositableChild(PCompositableChild* actor) MOZ_OVERRIDE;
    1.61 +
    1.62 +  virtual PTextureChild* AllocPTextureChild(const SurfaceDescriptor& aSharedData,
    1.63 +                                            const TextureFlags& aFlags) MOZ_OVERRIDE;
    1.64 +  virtual bool DeallocPTextureChild(PTextureChild* actor) MOZ_OVERRIDE;
    1.65 +
    1.66 +  virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
    1.67 +
    1.68 +  void AddIPDLReference() {
    1.69 +    MOZ_ASSERT(mIPCOpen == false);
    1.70 +    mIPCOpen = true;
    1.71 +    AddRef();
    1.72 +  }
    1.73 +  void ReleaseIPDLReference() {
    1.74 +    MOZ_ASSERT(mIPCOpen == true);
    1.75 +    mIPCOpen = false;
    1.76 +    Release();
    1.77 +  }
    1.78 +  friend class CompositorChild;
    1.79 +  friend class layout::RenderFrameChild;
    1.80 +
    1.81 +  bool mIPCOpen;
    1.82 +};
    1.83 +
    1.84 +} // namespace layers
    1.85 +} // namespace mozilla
    1.86 +
    1.87 +#endif // MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H

mercurial