Index: ash/rotator/screen_rotation_animator.h |
diff --git a/ash/rotator/screen_rotation_animator.h b/ash/rotator/screen_rotation_animator.h |
index 1852033b9e6b5c8aff54bd83d0a14275daf44adf..09f6f873682e1610ead5f1b5c48be0365fafab03 100644 |
--- a/ash/rotator/screen_rotation_animator.h |
+++ b/ash/rotator/screen_rotation_animator.h |
@@ -15,6 +15,7 @@ |
#include "ui/display/display.h" |
namespace cc { |
+class CopyOutputRequest; |
class CopyOutputResult; |
} // namespace cc |
@@ -64,16 +65,22 @@ class ASH_EXPORT ScreenRotationAnimator { |
using CopyCallback = |
base::Callback<void(std::unique_ptr<cc::CopyOutputResult> result)>; |
struct ScreenRotationRequest { |
- ScreenRotationRequest(display::Display::Rotation to_rotation, |
- display::Display::RotationSource from_source) |
- : new_rotation(to_rotation), source(from_source) {} |
+ ScreenRotationRequest(const display::Display::Rotation& from_rotation, |
oshima
2017/04/07 20:48:56
it's enum, so no need to pass by reference.
wutao
2017/04/10 08:01:07
Done.
|
+ const display::Display::Rotation& to_rotation, |
+ const display::Display::RotationSource& from_source) |
+ : old_rotation(from_rotation), |
+ new_rotation(to_rotation), |
+ source(from_source) {} |
+ display::Display::Rotation old_rotation; |
display::Display::Rotation new_rotation; |
display::Display::RotationSource source; |
}; |
// This function can be overridden in unit test to test removing external |
// display. |
- virtual CopyCallback CreateAfterCopyCallback( |
+ virtual CopyCallback CreateAfterCopyCallbackBeforeRotation( |
+ std::unique_ptr<ScreenRotationRequest> rotation_request); |
+ virtual CopyCallback CreateAfterCopyCallbackAfterRotation( |
std::unique_ptr<ScreenRotationRequest> rotation_request); |
private: |
@@ -82,20 +89,37 @@ class ASH_EXPORT ScreenRotationAnimator { |
void StartRotationAnimation( |
std::unique_ptr<ScreenRotationRequest> rotation_request); |
- // This is an asynchronous call to request copy output of root layer. |
- void RequestCopyRootLayerAndAnimateRotation( |
+ // The fallback to slow animation if copy output request cancled or failed. |
+ void StartSlowAnimation( |
std::unique_ptr<ScreenRotationRequest> rotation_request); |
- // The callback in |RequestCopyRootLayerAndAnimateRotation()|. |
- void OnRootLayerCopiedBeforeRotation( |
+ // A wrapper to call |display_manager| to set screen rotation and rotate the |
+ // |old_layer_tree| to the |old_rotation|. |
+ void SetRotation(const display::Display::Rotation& new_rotation, |
+ const display::Display::Rotation& old_rotation, |
+ const display::Display::RotationSource& source); |
+ |
+ // This is an asynchronous call to request copy output of root layer. |
+ void RequestCopyScreenRotationContainerLayer( |
+ std::unique_ptr<cc::CopyOutputRequest> copy_output_request); |
+ |
+ // The callback in |RequestCopyScreenRotationContainerLayer()| before screen |
+ // rotation. |
+ void OnScreenRotationContainerLayerCopiedBeforeRotation( |
+ std::unique_ptr<ScreenRotationRequest> rotation_request, |
+ std::unique_ptr<cc::CopyOutputResult> result); |
oshima
2017/04/07 20:48:57
new line after this
wutao
2017/04/10 08:01:07
Done.
|
+ // The callback in |RequestCopyScreenRotationContainerLayer()| after screen |
+ // rotation. |
+ void OnScreenRotationContainerLayerCopiedAfterRotation( |
std::unique_ptr<ScreenRotationRequest> rotation_request, |
std::unique_ptr<cc::CopyOutputResult> result); |
// Recreates all |root_window| layers. |
void CreateOldLayerTree(); |
- // Requests a copy of |root_window| root layer output. |
- void CopyOldLayerTree(std::unique_ptr<cc::CopyOutputResult> result); |
+ // Creates a new layer from |CopyOutputResult|. |
oshima
2017/04/07 20:48:57
new layer and its layer tree owner
wutao
2017/04/10 08:01:07
Done.
|
+ std::unique_ptr<ui::LayerTreeOwner> CopyLayerTree( |
+ std::unique_ptr<cc::CopyOutputResult> result); |
// Note: Only call this function when the |old_layer_tree_owner_| is set up |
// properly. |
@@ -119,6 +143,7 @@ class ASH_EXPORT ScreenRotationAnimator { |
base::ObserverList<ScreenRotationAnimatorObserver> |
screen_rotation_animator_observers_; |
std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; |
+ std::unique_ptr<ui::LayerTreeOwner> new_layer_tree_owner_; |
std::unique_ptr<ScreenRotationRequest> last_pending_request_; |
base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; |