1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/ipc/ImageBridgeParent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,123 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef gfx_layers_ipc_ImageBridgeParent_h_ 1.10 +#define gfx_layers_ipc_ImageBridgeParent_h_ 1.11 + 1.12 +#include <stddef.h> // for size_t 1.13 +#include <stdint.h> // for uint32_t, uint64_t 1.14 +#include "CompositableTransactionParent.h" 1.15 +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 1.16 +#include "mozilla/Attributes.h" // for MOZ_OVERRIDE 1.17 +#include "mozilla/ipc/ProtocolUtils.h" 1.18 +#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc 1.19 +#include "mozilla/layers/PImageBridgeParent.h" 1.20 +#include "nsAutoPtr.h" // for nsRefPtr 1.21 +#include "nsISupportsImpl.h" 1.22 +#include "nsTArrayForwardDeclare.h" // for InfallibleTArray 1.23 + 1.24 +class MessageLoop; 1.25 + 1.26 +namespace mozilla { 1.27 +namespace ipc { 1.28 +class Shmem; 1.29 +} 1.30 + 1.31 +namespace layers { 1.32 + 1.33 +/** 1.34 + * ImageBridgeParent is the manager Protocol of ImageContainerParent. 1.35 + * It's purpose is mainly to setup the IPDL connection. Most of the 1.36 + * interesting stuff is in ImageContainerParent. 1.37 + */ 1.38 +class ImageBridgeParent : public PImageBridgeParent, 1.39 + public CompositableParentManager 1.40 +{ 1.41 +public: 1.42 + typedef InfallibleTArray<CompositableOperation> EditArray; 1.43 + typedef InfallibleTArray<EditReply> EditReplyArray; 1.44 + 1.45 + ImageBridgeParent(MessageLoop* aLoop, Transport* aTransport); 1.46 + ~ImageBridgeParent(); 1.47 + 1.48 + virtual LayersBackend GetCompositorBackendType() const MOZ_OVERRIDE; 1.49 + 1.50 + virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; 1.51 + 1.52 + static PImageBridgeParent* 1.53 + Create(Transport* aTransport, ProcessId aOtherProcess); 1.54 + 1.55 + virtual PGrallocBufferParent* 1.56 + AllocPGrallocBufferParent(const IntSize&, const uint32_t&, const uint32_t&, 1.57 + MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE; 1.58 + 1.59 + virtual bool 1.60 + DeallocPGrallocBufferParent(PGrallocBufferParent* actor) MOZ_OVERRIDE; 1.61 + 1.62 + // PImageBridge 1.63 + virtual bool RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply) MOZ_OVERRIDE; 1.64 + virtual bool RecvUpdateNoSwap(const EditArray& aEdits) MOZ_OVERRIDE; 1.65 + 1.66 + virtual bool IsAsync() const MOZ_OVERRIDE { return true; } 1.67 + 1.68 + PCompositableParent* AllocPCompositableParent(const TextureInfo& aInfo, 1.69 + uint64_t*) MOZ_OVERRIDE; 1.70 + bool DeallocPCompositableParent(PCompositableParent* aActor) MOZ_OVERRIDE; 1.71 + 1.72 + virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData, 1.73 + const TextureFlags& aFlags) MOZ_OVERRIDE; 1.74 + virtual bool DeallocPTextureParent(PTextureParent* actor) MOZ_OVERRIDE; 1.75 + 1.76 + // Shutdown step 1 1.77 + virtual bool RecvWillStop() MOZ_OVERRIDE; 1.78 + // Shutdown step 2 1.79 + virtual bool RecvStop() MOZ_OVERRIDE; 1.80 + 1.81 + MessageLoop * GetMessageLoop(); 1.82 + 1.83 + 1.84 + // ISurfaceAllocator 1.85 + 1.86 + bool AllocShmem(size_t aSize, 1.87 + ipc::SharedMemory::SharedMemoryType aType, 1.88 + ipc::Shmem* aShmem) MOZ_OVERRIDE 1.89 + { 1.90 + return AllocShmem(aSize, aType, aShmem); 1.91 + } 1.92 + 1.93 + bool AllocUnsafeShmem(size_t aSize, 1.94 + ipc::SharedMemory::SharedMemoryType aType, 1.95 + ipc::Shmem* aShmem) MOZ_OVERRIDE 1.96 + { 1.97 + return AllocUnsafeShmem(aSize, aType, aShmem); 1.98 + } 1.99 + 1.100 + void DeallocShmem(ipc::Shmem& aShmem) MOZ_OVERRIDE 1.101 + { 1.102 + PImageBridgeParent::DeallocShmem(aShmem); 1.103 + } 1.104 + 1.105 + virtual bool IsSameProcess() const MOZ_OVERRIDE; 1.106 + 1.107 + // Overriden from IToplevelProtocol 1.108 + IToplevelProtocol* 1.109 + CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, 1.110 + base::ProcessHandle aPeerProcess, 1.111 + mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE; 1.112 + 1.113 +private: 1.114 + void DeferredDestroy(); 1.115 + 1.116 + MessageLoop* mMessageLoop; 1.117 + Transport* mTransport; 1.118 + // This keeps us alive until ActorDestroy(), at which point we do a 1.119 + // deferred destruction of ourselves. 1.120 + nsRefPtr<ImageBridgeParent> mSelfRef; 1.121 +}; 1.122 + 1.123 +} // layers 1.124 +} // mozilla 1.125 + 1.126 +#endif // gfx_layers_ipc_ImageBridgeParent_h_