Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| 11 #include "components/scheduler/renderer/renderer_scheduler.h" | 11 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 12 #include "components/scheduler/scheduler_export.h" | 12 #include "components/scheduler/scheduler_export.h" |
| 13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 14 | 14 |
| 15 namespace base { | |
| 16 class SingleThreadTaskRunner; | |
| 17 } | |
| 18 | |
| 15 namespace scheduler { | 19 namespace scheduler { |
| 16 | 20 |
| 17 class SCHEDULER_EXPORT UserModel { | 21 class SCHEDULER_EXPORT UserModel { |
| 18 public: | 22 public: |
| 19 UserModel(); | 23 UserModel(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 20 ~UserModel(); | 24 ~UserModel(); |
| 21 | 25 |
| 22 // Tells us that the system started processing an input event. Must be paired | 26 // Tells us that the system started processing an input event. Must be paired |
| 23 // with a call to DidFinishProcessingInputEvent. | 27 // with a call to DidFinishProcessingInputEvent. |
| 24 void DidStartProcessingInputEvent(blink::WebInputEvent::Type type, | 28 void DidStartProcessingInputEvent(blink::WebInputEvent::Type type, |
| 25 const base::TimeTicks now); | 29 const base::TimeTicks now); |
| 26 | 30 |
| 27 // Tells us that the system finished processing an input event. | 31 // Tells us that the system finished processing an input event. |
| 28 void DidFinishProcessingInputEvent(const base::TimeTicks now); | 32 void DidFinishProcessingInputEvent(const base::TimeTicks now); |
| 29 | 33 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 60 static const int kExpectSubsequentGestureMillis = 2000; | 64 static const int kExpectSubsequentGestureMillis = 2000; |
| 61 | 65 |
| 62 // Clears input signals. | 66 // Clears input signals. |
| 63 void Reset(base::TimeTicks now); | 67 void Reset(base::TimeTicks now); |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 bool IsGestureExpectedSoonImpl( | 70 bool IsGestureExpectedSoonImpl( |
| 67 const base::TimeTicks now, | 71 const base::TimeTicks now, |
| 68 base::TimeDelta* prediction_valid_duration) const; | 72 base::TimeDelta* prediction_valid_duration) const; |
| 69 | 73 |
| 74 // Task runner used to execute tasks on the main thread. | |
| 75 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
|
alex clarke (OOO till 29th)
2016/02/10 10:17:01
s/task_runner_/default_task_runner_
Reason being
beaudoin
2016/02/11 22:03:27
Done.
| |
| 76 | |
| 70 int pending_input_event_count_; | 77 int pending_input_event_count_; |
| 71 base::TimeTicks last_input_signal_time_; | 78 base::TimeTicks last_input_signal_time_; |
| 72 base::TimeTicks last_gesture_start_time_; | 79 base::TimeTicks last_gesture_start_time_; |
| 73 base::TimeTicks last_continuous_gesture_time_; // Doesn't include Taps. | 80 base::TimeTicks last_continuous_gesture_time_; // Doesn't include Taps. |
| 74 base::TimeTicks last_gesture_expected_start_time_; | 81 base::TimeTicks last_gesture_expected_start_time_; |
| 75 base::TimeTicks last_reset_time_; | 82 base::TimeTicks last_reset_time_; |
| 76 bool is_gesture_active_; // This typically means the user's finger is down. | 83 bool is_gesture_active_; // This typically means the user's finger is down. |
| 77 bool is_gesture_expected_; | 84 bool is_gesture_expected_; |
| 78 | 85 |
| 79 DISALLOW_COPY_AND_ASSIGN(UserModel); | 86 DISALLOW_COPY_AND_ASSIGN(UserModel); |
| 80 }; | 87 }; |
| 81 | 88 |
| 82 } // namespace scheduler | 89 } // namespace scheduler |
| 83 | 90 |
| 84 #endif // COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ | 91 #endif // COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ |
| OLD | NEW |