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

Side by Side Diff: ash/rotator/screen_rotation_animator.h

Issue 2771713004: Adds UMA for screen rotation animation smoothness. (Closed)
Patch Set: Adds histograms.xml. Created 3 years, 9 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 ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ 5 #ifndef ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_
6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ 6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void Rotate(display::Display::Rotation new_rotation, 42 void Rotate(display::Display::Rotation new_rotation,
43 display::Display::RotationSource source); 43 display::Display::RotationSource source);
44 44
45 int64_t display_id() const { return display_id_; } 45 int64_t display_id() const { return display_id_; }
46 46
47 void AddScreenRotationAnimatorObserver( 47 void AddScreenRotationAnimatorObserver(
48 ScreenRotationAnimatorObserver* observer); 48 ScreenRotationAnimatorObserver* observer);
49 void RemoveScreenRotationAnimatorObserver( 49 void RemoveScreenRotationAnimatorObserver(
50 ScreenRotationAnimatorObserver* observer); 50 ScreenRotationAnimatorObserver* observer);
51 51
52 void OnLayerAnimationEnded(); 52 // When screen rotation animation is ended or aborted, if the request queue is
53 53 // not empty, it will call |Rotate()| with the pending rotation request.
54 void OnLayerAnimationAborted(); 54 // Otherwise it will notify |screen_rotation_animator_observer_|.
varkha 2017/03/24 20:38:22 Change to declarative as in "When screen rotation
wutao 2017/03/24 21:48:24 Thanks. Done.
55 void ProcessAnimationQueue();
55 56
56 private: 57 private:
57 friend class ash::test::ScreenRotationAnimatorTestApi; 58 friend class ash::test::ScreenRotationAnimatorTestApi;
58 struct ScreenRotationRequest; 59 struct ScreenRotationRequest;
60 class ScreenRotationAnimationMetricsReporter;
59 61
60 // Set the screen orientation to |new_rotation| and animate the change. The 62 // Set the screen orientation to |new_rotation| and animate the change. The
61 // animation will rotate the initial orientation's layer towards the new 63 // animation will rotate the initial orientation's layer towards the new
62 // orientation through |rotation_degrees| while fading out, and the new 64 // orientation through |rotation_degrees| while fading out, and the new
63 // orientation's layer will be rotated in to the |new_orientation| through 65 // orientation's layer will be rotated in to the |new_orientation| through
64 // |rotation_degrees| arc. 66 // |rotation_degrees| arc.
65 void AnimateRotation(std::unique_ptr<ScreenRotationRequest> rotation_request); 67 void AnimateRotation(std::unique_ptr<ScreenRotationRequest> rotation_request);
66 68
67 // When screen rotation animation is ended or aborted, if the request queue is
68 // not empty, it will call |Rotate()| with the pending rotation request.
69 // Otherwise it will notify |screen_rotation_animator_observer_|.
70 void ProcessAnimationQueue();
71
72 void set_disable_animation_timers_for_test(bool disable_timers); 69 void set_disable_animation_timers_for_test(bool disable_timers);
73 70
74 void StopAnimating(); 71 void StopAnimating();
75 72
76 // The id of the display to rotate. 73 // The id of the display to rotate.
77 int64_t display_id_; 74 int64_t display_id_;
78 bool is_rotating_; 75 bool is_rotating_;
76 std::unique_ptr<ScreenRotationAnimationMetricsReporter> metrics_reporter_;
79 // Only set in unittest to disable animation timers. 77 // Only set in unittest to disable animation timers.
80 bool disable_animation_timers_for_test_; 78 bool disable_animation_timers_for_test_;
81 base::ObserverList<ScreenRotationAnimatorObserver> 79 base::ObserverList<ScreenRotationAnimatorObserver>
82 screen_rotation_animator_observers_; 80 screen_rotation_animator_observers_;
83 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; 81 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_;
84 std::unique_ptr<ScreenRotationRequest> last_pending_request_; 82 std::unique_ptr<ScreenRotationRequest> last_pending_request_;
85 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; 83 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_;
86 84
87 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); 85 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator);
88 }; 86 };
89 87
90 } // namespace ash 88 } // namespace ash
91 89
92 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ 90 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_
OLDNEW
« no previous file with comments | « no previous file | ash/rotator/screen_rotation_animator.cc » ('j') | ash/rotator/screen_rotation_animator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698