VsyncBridgeChild.h (1648B)
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 #ifndef include_gfx_ipc_VsyncBridgeChild_h 7 #define include_gfx_ipc_VsyncBridgeChild_h 8 9 #include "mozilla/RefPtr.h" 10 #include "mozilla/gfx/PVsyncBridgeChild.h" 11 12 namespace mozilla { 13 namespace gfx { 14 15 class VsyncIOThreadHolder; 16 17 class VsyncBridgeChild final : public PVsyncBridgeChild { 18 friend class NotifyVsyncTask; 19 20 public: 21 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncBridgeChild, final) 22 23 static RefPtr<VsyncBridgeChild> Create( 24 RefPtr<VsyncIOThreadHolder> aThread, const uint64_t& aProcessToken, 25 Endpoint<PVsyncBridgeChild>&& aEndpoint); 26 27 void Close(); 28 29 void ActorDestroy(ActorDestroyReason aWhy) override; 30 void ProcessingError(Result aCode, const char* aReason) override; 31 32 void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId); 33 34 void HandleFatalError(const char* aMsg) override; 35 36 private: 37 VsyncBridgeChild(RefPtr<VsyncIOThreadHolder>, const uint64_t& aProcessToken); 38 virtual ~VsyncBridgeChild(); 39 40 void Open(Endpoint<PVsyncBridgeChild>&& aEndpoint); 41 42 void NotifyVsyncImpl(const VsyncEvent& aVsync, 43 const layers::LayersId& aLayersId); 44 45 bool IsOnVsyncIOThread() const; 46 47 private: 48 RefPtr<VsyncIOThreadHolder> mThread; 49 uint64_t mProcessToken; 50 }; 51 52 } // namespace gfx 53 } // namespace mozilla 54 55 #endif // include_gfx_ipc_VsyncBridgeChild_h