Chromium Code Reviews| Index: ash/laser/laser_pointer_points.h |
| diff --git a/ash/laser/laser_pointer_points.h b/ash/laser/laser_pointer_points.h |
| index 19e95c1d1b3b1d6598cf47fb5483be7a9d153813..e2db4a30ae550b33dad87a67fd803d1310878849 100644 |
| --- a/ash/laser/laser_pointer_points.h |
| +++ b/ash/laser/laser_pointer_points.h |
| @@ -9,6 +9,7 @@ |
| #include <memory> |
| #include "ash/ash_export.h" |
| +#include "base/macros.h" |
| #include "base/time/time.h" |
| #include "ui/gfx/geometry/point.h" |
| #include "ui/gfx/geometry/rect.h" |
| @@ -23,7 +24,9 @@ class ASH_EXPORT LaserPointerPoints { |
| // Struct to describe each point. |
| struct LaserPoint { |
| gfx::Point location; |
| - base::Time creation_time; |
| + // age is a value between [0,1] where 0 means the point was just added and 1 |
| + // means that the point is just about to be removed. |
| + double age; |
|
jdufault
2016/10/14 21:59:47
double age = 0;
Then you can remove all of the ex
sammiequon
2016/10/17 19:12:24
Done.
|
| }; |
| // Constructor with a parameter to choose the fade out time of the points in |
| @@ -33,6 +36,9 @@ class ASH_EXPORT LaserPointerPoints { |
| // Adds a point. Automatically clears points that are too old. |
| void AddPoint(const gfx::Point& point); |
| + // Updates the collection latest time. Automatically clears points that are |
| + // too old. |
| + void MoveForwardToTime(const base::Time& latest_time); |
| // Removes all points. |
| void Clear(); |
| // Gets the bounding box of the points. |
| @@ -51,10 +57,11 @@ class ASH_EXPORT LaserPointerPoints { |
| private: |
| friend class LaserPointerPointsTestApi; |
| - void ClearOldPoints(); |
| - |
| base::TimeDelta life_duration_; |
| std::deque<LaserPoint> points_; |
| + // The latest time of the collection of points. This gets updated when new |
| + // points are added or when MoveForwardInTime is called. |
| + base::Time collection_latest_time_; |
| DISALLOW_COPY_AND_ASSIGN(LaserPointerPoints); |
| }; |