| 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..6ac045191a96d5536a45c50328159f9e75b3135a 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();
|
| }
|
| @@ -801,6 +809,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 +924,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();
|
| }
|
|
|