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

Side by Side Diff: components/scheduler/renderer/user_model.h

Issue 1683583002: Report user actions when gesture starts and stops in user_model. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not register action callback in single process. Created 4 years, 8 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
OLDNEW
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/feature_list.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
9 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
11 #include "components/scheduler/renderer/renderer_scheduler.h" 12 #include "components/scheduler/renderer/renderer_scheduler.h"
12 #include "components/scheduler/scheduler_export.h" 13 #include "components/scheduler/scheduler_export.h"
13 #include "third_party/WebKit/public/web/WebInputEvent.h" 14 #include "third_party/WebKit/public/web/WebInputEvent.h"
14 15
16 namespace base {
17 class SingleThreadTaskRunner;
18 } // namespace base
19
15 namespace scheduler { 20 namespace scheduler {
16 21
22 namespace features {
23 SCHEDULER_EXPORT extern const base::Feature kRecordSchedulerGestureActions;
24 } // namespace features
25
17 class SCHEDULER_EXPORT UserModel { 26 class SCHEDULER_EXPORT UserModel {
18 public: 27 public:
19 UserModel(); 28 explicit UserModel(
29 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner);
20 ~UserModel(); 30 ~UserModel();
21 31
22 // Tells us that the system started processing an input event. Must be paired 32 // Tells us that the system started processing an input event. Must be paired
23 // with a call to DidFinishProcessingInputEvent. 33 // with a call to DidFinishProcessingInputEvent.
24 void DidStartProcessingInputEvent(blink::WebInputEvent::Type type, 34 void DidStartProcessingInputEvent(blink::WebInputEvent::Type type,
25 const base::TimeTicks now); 35 const base::TimeTicks now);
26 36
27 // Tells us that the system finished processing an input event. 37 // Tells us that the system finished processing an input event.
28 void DidFinishProcessingInputEvent(const base::TimeTicks now); 38 void DidFinishProcessingInputEvent(const base::TimeTicks now);
29 39
(...skipping 30 matching lines...) Expand all
60 static const int kExpectSubsequentGestureMillis = 2000; 70 static const int kExpectSubsequentGestureMillis = 2000;
61 71
62 // Clears input signals. 72 // Clears input signals.
63 void Reset(base::TimeTicks now); 73 void Reset(base::TimeTicks now);
64 74
65 private: 75 private:
66 bool IsGestureExpectedSoonImpl( 76 bool IsGestureExpectedSoonImpl(
67 const base::TimeTicks now, 77 const base::TimeTicks now,
68 base::TimeDelta* prediction_valid_duration) const; 78 base::TimeDelta* prediction_valid_duration) const;
69 79
80 // Task runner used to execute tasks on the main thread.
81 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_;
82
70 int pending_input_event_count_; 83 int pending_input_event_count_;
71 base::TimeTicks last_input_signal_time_; 84 base::TimeTicks last_input_signal_time_;
72 base::TimeTicks last_gesture_start_time_; 85 base::TimeTicks last_gesture_start_time_;
73 base::TimeTicks last_continuous_gesture_time_; // Doesn't include Taps. 86 base::TimeTicks last_continuous_gesture_time_; // Doesn't include Taps.
74 base::TimeTicks last_gesture_expected_start_time_; 87 base::TimeTicks last_gesture_expected_start_time_;
75 base::TimeTicks last_reset_time_; 88 base::TimeTicks last_reset_time_;
76 bool is_gesture_active_; // This typically means the user's finger is down. 89 bool is_gesture_active_; // This typically means the user's finger is down.
77 bool is_gesture_expected_; 90 bool is_gesture_expected_;
78 91
79 DISALLOW_COPY_AND_ASSIGN(UserModel); 92 DISALLOW_COPY_AND_ASSIGN(UserModel);
80 }; 93 };
81 94
82 } // namespace scheduler 95 } // namespace scheduler
83 96
84 #endif // COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_ 97 #endif // COMPONENTS_SCHEDULER_RENDERER_USER_MODEL_H_
OLDNEW
« no previous file with comments | « components/scheduler/renderer/renderer_scheduler_impl.cc ('k') | components/scheduler/renderer/user_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698