Bug 1764201 Part 3: Remove screen info stuff from gfxPlatform. r=jgilbert,geckoview...
[gecko.git] / gfx / layers / apz / src / PotentialCheckerboardDurationTracker.h
blob58786f32afd6bdae5db1087d2c2cdb12002b5489
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/. */
7 #ifndef mozilla_layers_PotentialCheckerboardDurationTracker_h
8 #define mozilla_layers_PotentialCheckerboardDurationTracker_h
10 #include "mozilla/TimeStamp.h"
12 namespace mozilla {
13 namespace layers {
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.
27 class PotentialCheckerboardDurationTracker {
28 public:
29 PotentialCheckerboardDurationTracker();
31 /**
32 * This should be called if checkerboarding is encountered. It can be called
33 * multiple times during a checkerboard event.
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().
40 void CheckerboardDone(bool aRecordTelemetry);
42 /**
43 * This should be called at composition time, to indicate if the APZC is in
44 * a transforming state or not.
46 void InTransform(bool aInTransform, bool aRecordTelemetry);
48 private:
49 bool Tracking() const;
51 private:
52 bool mInCheckerboard;
53 bool mInTransform;
55 TimeStamp mCurrentPeriodStart;
58 } // namespace layers
59 } // namespace mozilla
61 #endif // mozilla_layers_PotentialCheckerboardDurationTracker_h