LCOV - code coverage report
Current view: top level - gfx/layers/ipc - CompositableTransactionParent.h (source / functions) Hit Total Coverage
Test: output.info Lines: 12 13 92.3 %
Date: 2017-07-14 16:53:18 Functions: 4 6 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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_COMPOSITABLETRANSACTIONPARENT_H
       9             : #define MOZILLA_LAYERS_COMPOSITABLETRANSACTIONPARENT_H
      10             : 
      11             : #include <vector>                       // for vector
      12             : #include "mozilla/Attributes.h"         // for override
      13             : #include "mozilla/layers/ISurfaceAllocator.h"  // for ISurfaceAllocator
      14             : #include "mozilla/layers/LayersMessages.h"  // for EditReply, etc
      15             : #include "mozilla/layers/TextureClient.h"
      16             : #include "CompositableHost.h"
      17             : 
      18             : namespace mozilla {
      19             : namespace layers {
      20             : 
      21             : // Since PCompositble has two potential manager protocols, we can't just call
      22             : // the Manager() method usually generated when there's one manager protocol,
      23             : // so both manager protocols implement this and we keep a reference to them
      24             : // through this interface.
      25           0 : class CompositableParentManager : public HostIPCAllocator
      26             : {
      27             : public:
      28             :   typedef InfallibleTArray<ReadLockInit> ReadLockArray;
      29             : 
      30           5 :   CompositableParentManager() {}
      31             : 
      32             :   void DestroyActor(const OpDestroy& aOp);
      33             : 
      34          28 :   void UpdateFwdTransactionId(uint64_t aTransactionId)
      35             :   {
      36          28 :     MOZ_ASSERT(mFwdTransactionId < aTransactionId);
      37          28 :     mFwdTransactionId = aTransactionId;
      38          28 :   }
      39             : 
      40             :   uint64_t GetFwdTransactionId() { return mFwdTransactionId; }
      41             : 
      42             :   RefPtr<CompositableHost> AddCompositable(
      43             :     const CompositableHandle& aHandle,
      44             :     const TextureInfo& aInfo);
      45             :   RefPtr<CompositableHost> FindCompositable(const CompositableHandle& aHandle);
      46             : 
      47             :   bool AddReadLocks(ReadLockArray&& aReadLocks);
      48             :   TextureReadLock* FindReadLock(const ReadLockHandle& aLockHandle);
      49             : 
      50             : protected:
      51             :   /**
      52             :    * Handle the IPDL messages that affect PCompositable actors.
      53             :    */
      54             :   bool ReceiveCompositableUpdate(const CompositableOperation& aEdit);
      55             : 
      56             :   void ReleaseCompositable(const CompositableHandle& aHandle);
      57             : 
      58             :   uint64_t mFwdTransactionId = 0;
      59             : 
      60             :   /**
      61             :    * Mapping form IDs to CompositableHosts.
      62             :    */
      63             :   std::map<uint64_t, RefPtr<CompositableHost>> mCompositables;
      64             :   std::map<uint64_t, RefPtr<TextureReadLock>> mReadLocks;
      65             : 
      66             : };
      67             : 
      68             : struct AutoClearReadLocks {
      69          28 :   explicit AutoClearReadLocks(std::map<uint64_t, RefPtr<TextureReadLock>>& aReadLocks)
      70          28 :     : mReadLocks(aReadLocks)
      71             : 
      72          28 :   {}
      73             : 
      74          28 :   ~AutoClearReadLocks()
      75          28 :   {
      76          28 :     mReadLocks.clear();
      77          28 :   }
      78             : 
      79             :   std::map<uint64_t, RefPtr<TextureReadLock>>& mReadLocks;
      80             : };
      81             : 
      82             : } // namespace layers
      83             : } // namespace mozilla
      84             : 
      85             : #endif

Generated by: LCOV version 1.13