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

Unified Diff: ash/rotator/screen_rotation_animator.h

Issue 2848883004: Add screen rotation animator lock. (Closed)
Patch Set: 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/BUILD.gn ('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 1c1a5c757c4e19c9263f9ca55480921bcc3762b8..584494c17afca51d1a466cddbd4ac3487803972b 100644
--- a/ash/rotator/screen_rotation_animator.h
+++ b/ash/rotator/screen_rotation_animator.h
@@ -35,6 +35,7 @@ namespace test {
class ScreenRotationAnimatorTestApi;
} // namespace test
+class ScreenRotationAnimatorLock;
class ScreenRotationAnimatorObserver;
// Utility to perform a screen rotation with an animation.
@@ -66,6 +67,9 @@ class ASH_EXPORT ScreenRotationAnimator {
// notifies |screen_rotation_animator_observer_|.
void ProcessAnimationQueue();
+ void AddAnimatorLock(ScreenRotationAnimatorLock* lock);
+ void RemoveAnimatorLock(ScreenRotationAnimatorLock* lock);
+
protected:
using CopyCallback =
base::Callback<void(std::unique_ptr<cc::CopyOutputResult> result)>;
@@ -150,6 +154,10 @@ class ASH_EXPORT ScreenRotationAnimator {
void StopAnimating();
+ ScreenRotationAnimatorLock* CreateAnimatorLock();
+ void TimeoutAnimatorLocks();
+ void ResetCreatedAnimatorLocks();
+
// The id of the display to rotate.
int64_t display_id_;
@@ -167,6 +175,14 @@ class ASH_EXPORT ScreenRotationAnimator {
// cancel the previous rotation request.
int64_t rotation_request_id_;
+ // The cached rotation request while waiting for the animator lock.
+ std::unique_ptr<ScreenRotationRequest> rotation_request_after_unlock_;
+ // The active locks waiting for.
+ std::vector<ScreenRotationAnimatorLock*> active_locks_;
+ // All the unique_ptr of the locks created. Hold the ownership so that we can
+ // release after animation.
+ std::vector<std::unique_ptr<ScreenRotationAnimatorLock>> created_locks_;
+
std::unique_ptr<ui::AnimationMetricsReporter> metrics_reporter_;
// Only set in unittest to disable animation timers.
bool disable_animation_timers_for_test_;
@@ -180,6 +196,7 @@ class ASH_EXPORT ScreenRotationAnimator {
aura::Window* root_window_;
ui::Layer* screen_rotation_container_layer_;
base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_;
+ base::WeakPtrFactory<ScreenRotationAnimator> lock_weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator);
};
« no previous file with comments | « ash/BUILD.gn ('k') | ash/rotator/screen_rotation_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698