LCOV - code coverage report
Current view: top level - gfx/layers/apz/src - AsyncPanZoomAnimation.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
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: set sw=2 ts=8 et 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_AsyncPanZoomAnimation_h_
       8             : #define mozilla_layers_AsyncPanZoomAnimation_h_
       9             : 
      10             : #include "base/message_loop.h"
      11             : #include "mozilla/RefPtr.h"
      12             : #include "mozilla/TimeStamp.h"
      13             : #include "FrameMetrics.h"
      14             : #include "nsISupportsImpl.h"
      15             : #include "nsTArray.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace layers {
      19             : 
      20             : class WheelScrollAnimation;
      21             : class KeyboardScrollAnimation;
      22             : class SmoothScrollAnimation;
      23             : 
      24             : class AsyncPanZoomAnimation {
      25           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AsyncPanZoomAnimation)
      26             : 
      27             : public:
      28           0 :   explicit AsyncPanZoomAnimation()
      29           0 :   { }
      30             : 
      31             :   virtual bool DoSample(FrameMetrics& aFrameMetrics,
      32             :                         const TimeDuration& aDelta) = 0;
      33             : 
      34           0 :   bool Sample(FrameMetrics& aFrameMetrics,
      35             :               const TimeDuration& aDelta) {
      36             :     // In some situations, particularly when handoff is involved, it's possible
      37             :     // for |aDelta| to be negative on the first call to sample. Ignore such a
      38             :     // sample here, to avoid each derived class having to deal with this case.
      39           0 :     if (aDelta.ToMilliseconds() <= 0) {
      40           0 :       return true;
      41             :     }
      42             : 
      43           0 :     return DoSample(aFrameMetrics, aDelta);
      44             :   }
      45             : 
      46             :   /**
      47             :    * Get the deferred tasks in |mDeferredTasks| and place them in |aTasks|. See
      48             :    * |mDeferredTasks| for more information.  Clears |mDeferredTasks|.
      49             :    */
      50           0 :   nsTArray<RefPtr<Runnable>> TakeDeferredTasks() {
      51           0 :     return Move(mDeferredTasks);
      52             :   }
      53             : 
      54           0 :   virtual KeyboardScrollAnimation* AsKeyboardScrollAnimation() {
      55           0 :     return nullptr;
      56             :   }
      57           0 :   virtual WheelScrollAnimation* AsWheelScrollAnimation() {
      58           0 :     return nullptr;
      59             :   }
      60           0 :   virtual SmoothScrollAnimation* AsSmoothScrollAnimation() {
      61           0 :     return nullptr;
      62             :   }
      63             : 
      64           0 :   virtual bool WantsRepaints() {
      65           0 :     return true;
      66             :   }
      67             : 
      68             : protected:
      69             :   // Protected destructor, to discourage deletion outside of Release():
      70           0 :   virtual ~AsyncPanZoomAnimation()
      71           0 :   { }
      72             : 
      73             :   /**
      74             :    * Tasks scheduled for execution after the APZC's mMonitor is released.
      75             :    * Derived classes can add tasks here in Sample(), and the APZC can call
      76             :    * ExecuteDeferredTasks() to execute them.
      77             :    */
      78             :   nsTArray<RefPtr<Runnable>> mDeferredTasks;
      79             : };
      80             : 
      81             : } // namespace layers
      82             : } // namespace mozilla
      83             : 
      84             : #endif // mozilla_layers_AsyncPanZoomAnimation_h_

Generated by: LCOV version 1.13