CompositableTransactionParent.h (2238B)
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_COMPOSITABLETRANSACTIONPARENT_H 8 #define MOZILLA_LAYERS_COMPOSITABLETRANSACTIONPARENT_H 9 10 #include "mozilla/NotNull.h" 11 #include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator 12 #include "mozilla/layers/LayersMessages.h" // for EditReply, etc 13 #include "mozilla/layers/TextureClient.h" 14 #include "CompositableHost.h" 15 16 namespace mozilla { 17 namespace layers { 18 19 // Since PCompositble has two potential manager protocols, we can't just call 20 // the Manager() method usually generated when there's one manager protocol, 21 // so both manager protocols implement this and we keep a reference to them 22 // through this interface. 23 class CompositableParentManager : public HostIPCAllocator { 24 public: 25 CompositableParentManager() = default; 26 27 void DestroyActor(const OpDestroy& aOp); 28 29 void UpdateFwdTransactionId(uint64_t aTransactionId) { 30 MOZ_ASSERT(mFwdTransactionId < aTransactionId); 31 mFwdTransactionId = aTransactionId; 32 } 33 34 uint64_t GetFwdTransactionId() { return mFwdTransactionId; } 35 36 RefPtr<CompositableHost> AddCompositable(const CompositableHandle& aHandle, 37 const TextureInfo& aInfo); 38 RefPtr<CompositableHost> FindCompositable(const CompositableHandle& aHandle); 39 40 protected: 41 /** 42 * Handle the IPDL messages that affect PCompositable actors. 43 */ 44 bool ReceiveCompositableUpdate(const CompositableOperation& aEdit); 45 bool ReceiveCompositableUpdate(const CompositableOperationDetail& aDetail, 46 NotNull<CompositableHost*> aCompositable, 47 const CompositableHandle& aHandle); 48 49 void ReleaseCompositable(const CompositableHandle& aHandle); 50 51 uint64_t mFwdTransactionId = 0; 52 53 /** 54 * Mapping form IDs to CompositableHosts. 55 */ 56 std::map<uint64_t, RefPtr<CompositableHost>> mCompositables; 57 }; 58 59 } // namespace layers 60 } // namespace mozilla 61 62 #endif