LCOV - code coverage report
Current view: top level - layout/ipc - VsyncChild.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 1 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef mozilla_layout_ipc_VsyncChild_h
       7             : #define mozilla_layout_ipc_VsyncChild_h
       8             : 
       9             : #include "mozilla/layout/PVsyncChild.h"
      10             : #include "nsISupportsImpl.h"
      11             : #include "mozilla/RefPtr.h"
      12             : 
      13             : namespace mozilla {
      14             : 
      15             : class VsyncObserver;
      16             : 
      17             : namespace ipc {
      18             : class BackgroundChildImpl;
      19             : } // namespace ipc
      20             : 
      21             : namespace layout {
      22             : 
      23             : // The PVsyncChild actor receives a vsync event from the main process and
      24             : // delivers it to the child process. Currently this is restricted to the main
      25             : // thread only. The actor will stay alive until the process dies or its
      26             : // PVsyncParent actor dies.
      27             : class VsyncChild final : public PVsyncChild
      28             : {
      29           2 :   NS_INLINE_DECL_REFCOUNTING(VsyncChild)
      30             : 
      31             :   friend class mozilla::ipc::BackgroundChildImpl;
      32             : 
      33             : public:
      34             :   // Hide the SendObserve/SendUnobserve in PVsyncChild. We add an flag
      35             :   // mObservingVsync to handle the race problem of unobserving vsync event.
      36             :   bool SendObserve();
      37             :   bool SendUnobserve();
      38             : 
      39             :   // Bind a VsyncObserver into VsyncChild after ipc channel connected.
      40             :   void SetVsyncObserver(VsyncObserver* aVsyncObserver);
      41             :   // GetVsyncRate is a getter for mVsyncRate which sends a requests to
      42             :   // VsyncParent to retreive the hardware vsync rate if mVsyncRate
      43             :   // hasn't already been set.
      44             :   TimeDuration GetVsyncRate();
      45             :   // VsyncRate is a getter for mVsyncRate which always returns
      46             :   // mVsyncRate directly, potentially returning
      47             :   // TimeDuration::Forever() if mVsyncRate hasn't been set by calling
      48             :   // GetVsyncRate.
      49             :   TimeDuration VsyncRate();
      50             : 
      51             : private:
      52             :   VsyncChild();
      53             :   virtual ~VsyncChild();
      54             : 
      55             :   virtual mozilla::ipc::IPCResult RecvNotify(const TimeStamp& aVsyncTimestamp) override;
      56             :   virtual mozilla::ipc::IPCResult RecvVsyncRate(const float& aVsyncRate) override;
      57             :   virtual void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
      58             : 
      59             :   bool mObservingVsync;
      60             :   bool mIsShutdown;
      61             : 
      62             :   // The content side vsync observer.
      63             :   RefPtr<VsyncObserver> mObserver;
      64             :   TimeDuration mVsyncRate;
      65             : };
      66             : 
      67             : } // namespace layout
      68             : } // namespace mozilla
      69             : 
      70             : #endif  // mozilla_layout_ipc_VsyncChild_h

Generated by: LCOV version 1.13