gfx/layers/ipc/ImageBridgeParent.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef gfx_layers_ipc_ImageBridgeParent_h_
michael@0 7 #define gfx_layers_ipc_ImageBridgeParent_h_
michael@0 8
michael@0 9 #include <stddef.h> // for size_t
michael@0 10 #include <stdint.h> // for uint32_t, uint64_t
michael@0 11 #include "CompositableTransactionParent.h"
michael@0 12 #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
michael@0 13 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE
michael@0 14 #include "mozilla/ipc/ProtocolUtils.h"
michael@0 15 #include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
michael@0 16 #include "mozilla/layers/PImageBridgeParent.h"
michael@0 17 #include "nsAutoPtr.h" // for nsRefPtr
michael@0 18 #include "nsISupportsImpl.h"
michael@0 19 #include "nsTArrayForwardDeclare.h" // for InfallibleTArray
michael@0 20
michael@0 21 class MessageLoop;
michael@0 22
michael@0 23 namespace mozilla {
michael@0 24 namespace ipc {
michael@0 25 class Shmem;
michael@0 26 }
michael@0 27
michael@0 28 namespace layers {
michael@0 29
michael@0 30 /**
michael@0 31 * ImageBridgeParent is the manager Protocol of ImageContainerParent.
michael@0 32 * It's purpose is mainly to setup the IPDL connection. Most of the
michael@0 33 * interesting stuff is in ImageContainerParent.
michael@0 34 */
michael@0 35 class ImageBridgeParent : public PImageBridgeParent,
michael@0 36 public CompositableParentManager
michael@0 37 {
michael@0 38 public:
michael@0 39 typedef InfallibleTArray<CompositableOperation> EditArray;
michael@0 40 typedef InfallibleTArray<EditReply> EditReplyArray;
michael@0 41
michael@0 42 ImageBridgeParent(MessageLoop* aLoop, Transport* aTransport);
michael@0 43 ~ImageBridgeParent();
michael@0 44
michael@0 45 virtual LayersBackend GetCompositorBackendType() const MOZ_OVERRIDE;
michael@0 46
michael@0 47 virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
michael@0 48
michael@0 49 static PImageBridgeParent*
michael@0 50 Create(Transport* aTransport, ProcessId aOtherProcess);
michael@0 51
michael@0 52 virtual PGrallocBufferParent*
michael@0 53 AllocPGrallocBufferParent(const IntSize&, const uint32_t&, const uint32_t&,
michael@0 54 MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
michael@0 55
michael@0 56 virtual bool
michael@0 57 DeallocPGrallocBufferParent(PGrallocBufferParent* actor) MOZ_OVERRIDE;
michael@0 58
michael@0 59 // PImageBridge
michael@0 60 virtual bool RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply) MOZ_OVERRIDE;
michael@0 61 virtual bool RecvUpdateNoSwap(const EditArray& aEdits) MOZ_OVERRIDE;
michael@0 62
michael@0 63 virtual bool IsAsync() const MOZ_OVERRIDE { return true; }
michael@0 64
michael@0 65 PCompositableParent* AllocPCompositableParent(const TextureInfo& aInfo,
michael@0 66 uint64_t*) MOZ_OVERRIDE;
michael@0 67 bool DeallocPCompositableParent(PCompositableParent* aActor) MOZ_OVERRIDE;
michael@0 68
michael@0 69 virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData,
michael@0 70 const TextureFlags& aFlags) MOZ_OVERRIDE;
michael@0 71 virtual bool DeallocPTextureParent(PTextureParent* actor) MOZ_OVERRIDE;
michael@0 72
michael@0 73 // Shutdown step 1
michael@0 74 virtual bool RecvWillStop() MOZ_OVERRIDE;
michael@0 75 // Shutdown step 2
michael@0 76 virtual bool RecvStop() MOZ_OVERRIDE;
michael@0 77
michael@0 78 MessageLoop * GetMessageLoop();
michael@0 79
michael@0 80
michael@0 81 // ISurfaceAllocator
michael@0 82
michael@0 83 bool AllocShmem(size_t aSize,
michael@0 84 ipc::SharedMemory::SharedMemoryType aType,
michael@0 85 ipc::Shmem* aShmem) MOZ_OVERRIDE
michael@0 86 {
michael@0 87 return AllocShmem(aSize, aType, aShmem);
michael@0 88 }
michael@0 89
michael@0 90 bool AllocUnsafeShmem(size_t aSize,
michael@0 91 ipc::SharedMemory::SharedMemoryType aType,
michael@0 92 ipc::Shmem* aShmem) MOZ_OVERRIDE
michael@0 93 {
michael@0 94 return AllocUnsafeShmem(aSize, aType, aShmem);
michael@0 95 }
michael@0 96
michael@0 97 void DeallocShmem(ipc::Shmem& aShmem) MOZ_OVERRIDE
michael@0 98 {
michael@0 99 PImageBridgeParent::DeallocShmem(aShmem);
michael@0 100 }
michael@0 101
michael@0 102 virtual bool IsSameProcess() const MOZ_OVERRIDE;
michael@0 103
michael@0 104 // Overriden from IToplevelProtocol
michael@0 105 IToplevelProtocol*
michael@0 106 CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds,
michael@0 107 base::ProcessHandle aPeerProcess,
michael@0 108 mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE;
michael@0 109
michael@0 110 private:
michael@0 111 void DeferredDestroy();
michael@0 112
michael@0 113 MessageLoop* mMessageLoop;
michael@0 114 Transport* mTransport;
michael@0 115 // This keeps us alive until ActorDestroy(), at which point we do a
michael@0 116 // deferred destruction of ourselves.
michael@0 117 nsRefPtr<ImageBridgeParent> mSelfRef;
michael@0 118 };
michael@0 119
michael@0 120 } // layers
michael@0 121 } // mozilla
michael@0 122
michael@0 123 #endif // gfx_layers_ipc_ImageBridgeParent_h_

mercurial