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

Unified Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h

Issue 2919513002: [Media Controls] Prevent fullscreen orientation lock rotate glitch (Closed)
Patch Set: Rebase Created 3 years, 6 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 | « no previous file | third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
index 27da86920008aac063b002b2e1bc64b50537c29c..d2ac59f3d54177aac7d875a33e2649b295ad3580 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
@@ -8,6 +8,7 @@
#include "core/events/EventListener.h"
#include "device/screen_orientation/public/interfaces/screen_orientation.mojom-blink.h"
#include "modules/ModulesExport.h"
+#include "platform/WebTaskRunner.h"
#include "platform/wtf/Optional.h"
#include "public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
@@ -114,6 +115,11 @@ class MediaControlsOrientationLockDelegate final : public EventListener {
void MaybeUnlockIfDeviceOrientationMatchesVideo(DeviceOrientationEvent*);
+ // Delay before unlocking - see `MaybeUnlockIfDeviceOrientationMatchesVideo`.
+ // Emprically, 200ms is too short, but 250ms avoids glitches. 500ms gives us
+ // a 2x margin in case the device is running slow, without being noticeable.
+ static constexpr int kUnlockDelayMs = 500;
+
// Current state of the object. See comment at the top of the file for a
// detailed description.
State state_ = State::kPendingFullscreen;
@@ -122,6 +128,8 @@ class MediaControlsOrientationLockDelegate final : public EventListener {
WebScreenOrientationLockType locked_orientation_ =
kWebScreenOrientationLockDefault /* unlocked */;
+ TaskHandle unlock_task_;
+
device::mojom::blink::ScreenOrientationListenerPtr monitor_;
WTF::Optional<bool> is_auto_rotate_enabled_by_user_override_for_testing_;
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698