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

Unified Diff: ash/rotator/screen_rotation_animator.h

Issue 2780823002: Uses copy request to flatten the layers to do screen rotation animation. (Closed)
Patch Set: Resolve merge conflicts. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/ash_switches.cc ('k') | ash/rotator/screen_rotation_animator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1852033b9e6b5c8aff54bd83d0a14275daf44adf 100644
--- a/ash/rotator/screen_rotation_animator.h
+++ b/ash/rotator/screen_rotation_animator.h
@@ -8,11 +8,16 @@
#include <stdint.h>
#include "ash/ash_export.h"
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "ui/display/display.h"
+namespace cc {
+class CopyOutputResult;
+} // namespace cc
+
namespace ui {
class AnimationMetricsReporter;
class Layer;
@@ -30,7 +35,7 @@ class ScreenRotationAnimatorObserver;
class ASH_EXPORT ScreenRotationAnimator {
public:
explicit ScreenRotationAnimator(int64_t display_id);
- ~ScreenRotationAnimator();
+ virtual ~ScreenRotationAnimator();
// Rotates the display::Display specified by |display_id_| to the
// |new_rotation| orientation, for the given |source|. The rotation will also
@@ -55,11 +60,46 @@ class ASH_EXPORT ScreenRotationAnimator {
// notifies |screen_rotation_animator_observer_|.
void ProcessAnimationQueue();
+ protected:
+ 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) {}
+ 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(
+ std::unique_ptr<ScreenRotationRequest> rotation_request);
+
private:
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);
+
+ // This is an asynchronous call to request copy output of root layer.
+ void RequestCopyRootLayerAndAnimateRotation(
+ std::unique_ptr<ScreenRotationRequest> rotation_request);
+
+ // The callback in |RequestCopyRootLayerAndAnimateRotation()|.
+ void OnRootLayerCopiedBeforeRotation(
+ 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);
+
+ // Note: Only call this function when the |old_layer_tree_owner_| is set up
+ // properly.
+ // 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
« no previous file with comments | « ash/common/ash_switches.cc ('k') | ash/rotator/screen_rotation_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698