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

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/gesture_timer_provider.cc

Issue 884313002: Fix uninitialized timestamps being passed to the gesture lib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_timer_provider.h" 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_timer_provider.h"
6 6
7 #include <gestures/gestures.h> 7 #include <gestures/gestures.h>
8 8
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 10
(...skipping 11 matching lines...) Expand all
22 delay * base::Time::kMicrosecondsPerSecond), 22 delay * base::Time::kMicrosecondsPerSecond),
23 this, 23 this,
24 &GesturesTimer::OnTimerExpired); 24 &GesturesTimer::OnTimerExpired);
25 } 25 }
26 26
27 void Cancel() { timer_.Stop(); } 27 void Cancel() { timer_.Stop(); }
28 28
29 private: 29 private:
30 void OnTimerExpired() { 30 void OnTimerExpired() {
31 struct timespec ts; 31 struct timespec ts;
32 DCHECK(!clock_gettime(CLOCK_MONOTONIC, &ts)); 32 int fail = clock_gettime(CLOCK_MONOTONIC, &ts);
33 DCHECK(!fail);
34
35 // Run the callback and reschedule the next run if requested.
33 stime_t next_delay = callback_(StimeFromTimespec(&ts), callback_data_); 36 stime_t next_delay = callback_(StimeFromTimespec(&ts), callback_data_);
34 if (next_delay >= 0) { 37 if (next_delay >= 0) {
35 timer_.Start(FROM_HERE, 38 timer_.Start(FROM_HERE,
36 base::TimeDelta::FromMicroseconds( 39 base::TimeDelta::FromMicroseconds(
37 next_delay * base::Time::kMicrosecondsPerSecond), 40 next_delay * base::Time::kMicrosecondsPerSecond),
38 this, 41 this,
39 &GesturesTimer::OnTimerExpired); 42 &GesturesTimer::OnTimerExpired);
40 } 43 }
41 } 44 }
42 45
(...skipping 20 matching lines...) Expand all
63 66
64 void GesturesTimerFree(void* data, GesturesTimer* timer) { delete timer; } 67 void GesturesTimerFree(void* data, GesturesTimer* timer) { delete timer; }
65 68
66 } // namespace 69 } // namespace
67 70
68 const GesturesTimerProvider kGestureTimerProvider = { 71 const GesturesTimerProvider kGestureTimerProvider = {
69 GesturesTimerCreate, GesturesTimerSet, GesturesTimerCancel, 72 GesturesTimerCreate, GesturesTimerSet, GesturesTimerCancel,
70 GesturesTimerFree}; 73 GesturesTimerFree};
71 74
72 } // namespace ui 75 } // namespace ui
OLDNEW
« 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