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

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2926953002: Fix WebVR so we don't animation when stopped at a JS breakpoint (Closed)
Patch Set: cr feedback 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 | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index ace724eec6f9ca1ef506f130936aee361715a9f3..6504e1aa65875400b119787f9257a502d95b74ee 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -55,17 +55,25 @@ VREye StringToVREye(const String& which_eye) {
VRDisplay::VRDisplay(NavigatorVR* navigator_vr,
device::mojom::blink::VRDisplayPtr display,
device::mojom::blink::VRDisplayClientRequest request)
- : ContextLifecycleObserver(navigator_vr->GetDocument()),
+ : SuspendableObject(navigator_vr->GetDocument()),
navigator_vr_(navigator_vr),
capabilities_(new VRDisplayCapabilities()),
eye_parameters_left_(new VREyeParameters()),
eye_parameters_right_(new VREyeParameters()),
display_(std::move(display)),
submit_frame_client_binding_(this),
- display_client_binding_(this, std::move(request)) {}
+ display_client_binding_(this, std::move(request)) {
+ SuspendIfNeeded(); // Initialize SuspendabaleObject.
+}
VRDisplay::~VRDisplay() {}
+void VRDisplay::Suspend() {}
+
+void VRDisplay::Resume() {
+ RequestVSync();
+}
+
VRController* VRDisplay::Controller() {
return navigator_vr_->Controller();
}
@@ -135,6 +143,9 @@ void VRDisplay::RequestVSync() {
<< " in_animation_frame_=" << in_animation_frame_
<< " did_submit_this_frame_=" << did_submit_this_frame_;
+ if (!pending_vrdisplay_raf_)
+ return;
+
// The logic here is a bit subtle. We get called from one of the following
// four contexts:
//
@@ -801,6 +812,12 @@ void VRDisplay::ProcessScheduledAnimations(double timestamp) {
return;
}
+ if (doc->IsContextSuspended()) {
+ // We are currently suspended - try ProcessScheduledAnimations again later
+ // when we resume.
+ return;
+ }
+
TRACE_EVENT1("gpu", "VRDisplay::OnVSync", "frame", vr_frame_id_);
if (pending_vrdisplay_raf_ && scripted_animation_controller_) {
@@ -910,7 +927,8 @@ const AtomicString& VRDisplay::InterfaceName() const {
return EventTargetNames::VRDisplay;
}
-void VRDisplay::ContextDestroyed(ExecutionContext*) {
+void VRDisplay::ContextDestroyed(ExecutionContext* context) {
+ SuspendableObject::ContextDestroyed(context);
ForceExitPresent();
scripted_animation_controller_.Clear();
}
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698