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 c0d5c4e0c018a553eb3694d746b9969b90257c78..2fb51eb7a22bc52a12f9de73a174f70efa99d492 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
@@ -690,10 +690,17 @@ void VRDisplay::OnDeactivate( |
} |
void VRDisplay::processScheduledAnimations(double timestamp) { |
+ // Check if we still have a valid context, the animation controller |
+ // or document may have disappeared since we scheduled this. |
+ Document* doc = this->document(); |
+ if (!doc || m_displayBlurred || !m_scriptedAnimationController) |
+ return; |
+ |
TRACE_EVENT1("gpu", "VRDisplay::OnVSync", "frame", m_vrFrameId); |
AutoReset<bool> animating(&m_inAnimationFrame, true); |
m_pendingRaf = false; |
+ |
m_scriptedAnimationController->serviceScriptedAnimations(timestamp); |
} |
@@ -708,9 +715,6 @@ void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose, |
return; |
} |
m_pendingVsync = false; |
- Document* doc = this->document(); |
- if (!doc || m_displayBlurred || !m_scriptedAnimationController) |
- return; |
WTF::TimeDelta timeDelta = |
WTF::TimeDelta::FromMicroseconds(time->microseconds); |