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

Unified Diff: ash/rotator/screen_rotation_animator.h

Issue 2790583004: Add second copy request after screen rotation to flatten the layers in animation. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ash/rotator/screen_rotation_animator.h
diff --git a/ash/rotator/screen_rotation_animator.h b/ash/rotator/screen_rotation_animator.h
index b541106e88030c68a5217cc03451e46268688eae..67ec82c9ca1bb282957c21f7c4637140c93675d6 100644
--- a/ash/rotator/screen_rotation_animator.h
+++ b/ash/rotator/screen_rotation_animator.h
@@ -11,10 +11,16 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "cc/output/copy_output_request.h"
#include "ui/display/display.h"
+namespace cc {
+class CopyOutputResult;
+} // namespace cc
+
namespace ui {
class AnimationMetricsReporter;
+class CallbackLayerAnimationObserver;
class Layer;
class LayerTreeOwner;
} // namespace ui
@@ -59,7 +65,42 @@ class ASH_EXPORT ScreenRotationAnimator {
friend class ash::test::ScreenRotationAnimatorTestApi;
struct ScreenRotationRequest;
- // Set the screen orientation to |new_rotation| and animate the change. The
+ void StartRotationAnimation(
+ std::unique_ptr<ScreenRotationRequest> rotation_request);
+
+ // The fallback plan if copy output request failed, such as the request is
+ // canceled.
+ void StartSlowAnimation(
+ std::unique_ptr<ScreenRotationRequest> rotation_request);
+
+ // This is an asynchronous call to request copy output of root layer.
+ void RequestCopyRootLayerByName(
+ const std::string& layer_name,
+ const cc::CopyOutputRequest::CopyOutputRequestCallback& callback);
+
+ // The callback for the first CopyOutputRequest before screen rotation.
+ void OnRootLayerCopiedBeforeRotation(
+ std::unique_ptr<ScreenRotationRequest> rotation_request,
+ std::unique_ptr<cc::CopyOutputResult> result);
+
+ // The callback for the second CopyOutputRequest after screen rotation.
+ void OnRootLayerCopiedAfterRotation(
+ std::unique_ptr<ScreenRotationRequest> rotation_request,
+ std::unique_ptr<cc::CopyOutputResult> result);
+
+ // Recreates all |root_window| layers.
+ void CreateOldLayerTree();
+
+ // Creates a copy layer from cc::CopyOutputResult |result|.
+ std::unique_ptr<ui::LayerTreeOwner> CopyLayerTree(
+ const std::string& layer_name,
+ std::unique_ptr<cc::CopyOutputResult> result);
+
+ void SetRotation(const display::Display::Rotation& new_rotation,
+ const display::Display::Rotation& old_rotation,
+ const display::Display::RotationSource& source);
+
+ // Sets the screen orientation to |new_rotation| and animate the change. The
// animation will rotate the initial orientation's layer towards the new
// orientation through |rotation_degrees| while fading out, and the new
// orientation's layer will be rotated in to the |new_orientation| through
@@ -79,6 +120,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_;

Powered by Google App Engine
This is Rietveld 408576698