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 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 | 57 |
| 58 // When screen rotation animation is ended or aborted, calls |Rotate()| with | 58 // When screen rotation animation is ended or aborted, calls |Rotate()| with |
| 59 // the pending rotation request if the request queue is not empty. Otherwise | 59 // the pending rotation request if the request queue is not empty. Otherwise |
| 60 // notifies |screen_rotation_animator_observer_|. | 60 // notifies |screen_rotation_animator_observer_|. |
| 61 void ProcessAnimationQueue(); | 61 void ProcessAnimationQueue(); |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 using CopyCallback = | 64 using CopyCallback = |
| 65 base::Callback<void(std::unique_ptr<cc::CopyOutputResult> result)>; | 65 base::Callback<void(std::unique_ptr<cc::CopyOutputResult> result)>; |
| 66 struct ScreenRotationRequest { | 66 struct ScreenRotationRequest { |
| 67 ScreenRotationRequest(display::Display::Rotation to_rotation, | 67 ScreenRotationRequest(int64_t id, |
| 68 display::Display::Rotation to_rotation, | |
| 68 display::Display::RotationSource from_source) | 69 display::Display::RotationSource from_source) |
| 69 : new_rotation(to_rotation), source(from_source) {} | 70 : id(id), new_rotation(to_rotation), source(from_source) {} |
| 71 int64_t id; | |
| 70 display::Display::Rotation new_rotation; | 72 display::Display::Rotation new_rotation; |
| 71 display::Display::RotationSource source; | 73 display::Display::RotationSource source; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 // This function can be overridden in unit test to test removing external | 76 // This function can be overridden in unit test to test removing external |
| 75 // display. | 77 // display. |
| 76 virtual CopyCallback CreateAfterCopyCallback( | 78 virtual CopyCallback CreateAfterCopyCallback( |
| 77 std::unique_ptr<ScreenRotationRequest> rotation_request); | 79 std::unique_ptr<ScreenRotationRequest> rotation_request); |
| 78 | 80 |
| 79 private: | 81 private: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 // For current slow rotation animation, there are two states |ROTATING| and | 118 // For current slow rotation animation, there are two states |ROTATING| and |
| 117 // |IDLE|. For the smooth rotation animation, we need to send copy request | 119 // |IDLE|. For the smooth rotation animation, we need to send copy request |
| 118 // and get copy result before animating. | 120 // and get copy result before animating. |
| 119 enum ScreenRotationState { | 121 enum ScreenRotationState { |
| 120 COPY_REQUESTED, | 122 COPY_REQUESTED, |
| 121 ROTATING, | 123 ROTATING, |
| 122 IDLE, | 124 IDLE, |
| 123 }; | 125 }; |
| 124 ScreenRotationState screen_rotation_state_; | 126 ScreenRotationState screen_rotation_state_; |
| 125 | 127 |
| 128 // Rotation request id, used to ignore copy request callback if we decide to | |
| 129 // cancel the previous rotation request. | |
| 130 int64_t rotation_request_id_; | |
|
oshima
2017/04/13 18:18:24
= 0
wutao
2017/04/13 18:54:30
Keep as it. I init it in the init list.
| |
| 131 | |
| 126 std::unique_ptr<ui::AnimationMetricsReporter> metrics_reporter_; | 132 std::unique_ptr<ui::AnimationMetricsReporter> metrics_reporter_; |
| 127 // Only set in unittest to disable animation timers. | 133 // Only set in unittest to disable animation timers. |
| 128 bool disable_animation_timers_for_test_; | 134 bool disable_animation_timers_for_test_; |
| 129 base::ObserverList<ScreenRotationAnimatorObserver> | 135 base::ObserverList<ScreenRotationAnimatorObserver> |
| 130 screen_rotation_animator_observers_; | 136 screen_rotation_animator_observers_; |
| 131 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; | 137 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; |
| 132 std::unique_ptr<ScreenRotationRequest> last_pending_request_; | 138 std::unique_ptr<ScreenRotationRequest> last_pending_request_; |
| 133 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; | 139 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; |
| 134 | 140 |
| 135 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); | 141 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); |
| 136 }; | 142 }; |
| 137 | 143 |
| 138 } // namespace ash | 144 } // namespace ash |
| 139 | 145 |
| 140 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ | 146 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ |
| OLD | NEW |