tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PotentialCheckerboardDurationTracker.h (2100B)


      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_PotentialCheckerboardDurationTracker_h
      8 #define mozilla_layers_PotentialCheckerboardDurationTracker_h
      9 
     10 #include "mozilla/TimeStamp.h"
     11 
     12 namespace mozilla {
     13 namespace layers {
     14 
     15 /**
     16 * This class allows the owner to track the duration of time considered
     17 * "potentially checkerboarding". This is the union of two possibly-intersecting
     18 * sets of time periods. The first set is that in which checkerboarding was
     19 * actually happening, since by definition it could potentially be happening.
     20 * The second set is that in which the APZC is actively transforming content
     21 * in the compositor, since it could potentially transform it so as to display
     22 * checkerboarding to the user.
     23 * The caller of this class calls the appropriate methods to indicate the start
     24 * and stop of these two sets, and this class manages accumulating the union
     25 * of the various durations.
     26 */
     27 class PotentialCheckerboardDurationTracker {
     28 public:
     29  PotentialCheckerboardDurationTracker();
     30 
     31  /**
     32   * This should be called if checkerboarding is encountered. It can be called
     33   * multiple times during a checkerboard event.
     34   */
     35  void CheckerboardSeen();
     36  /**
     37   * This should be called when checkerboarding is done. It must have been
     38   * preceded by one or more calls to CheckerboardSeen().
     39   */
     40  void CheckerboardDone(bool aRecordTelemetry);
     41 
     42  /**
     43   * This should be called at composition time, to indicate if the APZC is in
     44   * a transforming state or not.
     45   */
     46  void InTransform(bool aInTransform, bool aRecordTelemetry);
     47 
     48 private:
     49  bool Tracking() const;
     50 
     51 private:
     52  bool mInCheckerboard;
     53  bool mInTransform;
     54 
     55  TimeStamp mCurrentPeriodStart;
     56 };
     57 
     58 }  // namespace layers
     59 }  // namespace mozilla
     60 
     61 #endif  // mozilla_layers_PotentialCheckerboardDurationTracker_h