Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: ash/laser/laser_pointer_controller.cc

Issue 2723653003: ash: Avoid unnecessary laser pointer updates. (Closed)
Patch Set: comment and TODO Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/laser/laser_pointer_controller.cc
diff --git a/ash/laser/laser_pointer_controller.cc b/ash/laser/laser_pointer_controller.cc
index c027badf08fca09dfb15d694595bdf31898d2e7c..ac8de4ebc5d5032e9334efa4a98ec40f26bda418 100644
--- a/ash/laser/laser_pointer_controller.cc
+++ b/ash/laser/laser_pointer_controller.cc
@@ -20,7 +20,11 @@ const int kPointLifeDurationMs = 200;
// When no move events are being received we add a new point every
// |kAddStationaryPointsDelayMs| so that points older than
// |kPointLifeDurationMs| can get removed.
-const int kAddStationaryPointsDelayMs = 5;
+// Note: Using a delay less than the screen refresh interval will not
+// provide a visual benefit but instead just waste time performing
+// unnecessary updates. 16ms is the refresh interval on most devices.
+// TODO(reveman): Use real VSYNC interval instead of a hard-coded delay.
+const int kAddStationaryPointsDelayMs = 16;
} // namespace
@@ -128,8 +132,7 @@ void LaserPointerController::DestroyLaserPointerView() {
void LaserPointerController::RestartTimer() {
stationary_timer_repeat_count_ = 0;
- if (!stationary_timer_->IsRunning())
- stationary_timer_->Reset();
+ stationary_timer_->Reset();
}
void LaserPointerController::AddStationaryPoint() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698