| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/vr/VRDisplay.h" | 5 #include "modules/vr/VRDisplay.h" |
| 6 | 6 |
| 7 #include "core/css/StylePropertySet.h" | 7 #include "core/css/StylePropertySet.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/FrameRequestCallback.h" | 9 #include "core/dom/FrameRequestCallback.h" |
| 10 #include "core/dom/ScriptedAnimationController.h" | 10 #include "core/dom/ScriptedAnimationController.h" |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 // Trigger any callbacks on window.rAF manually so that they run after | 763 // Trigger any callbacks on window.rAF manually so that they run after |
| 764 // completing the vrDisplay.rAF processing. | 764 // completing the vrDisplay.rAF processing. |
| 765 if (is_presenting_ && !capabilities_->hasExternalDisplay()) { | 765 if (is_presenting_ && !capabilities_->hasExternalDisplay()) { |
| 766 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask( | 766 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask( |
| 767 BLINK_FROM_HERE, WTF::Bind(&VRDisplay::ProcessScheduledWindowAnimations, | 767 BLINK_FROM_HERE, WTF::Bind(&VRDisplay::ProcessScheduledWindowAnimations, |
| 768 WrapWeakPersistent(this), timestamp)); | 768 WrapWeakPersistent(this), timestamp)); |
| 769 } | 769 } |
| 770 } | 770 } |
| 771 | 771 |
| 772 void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose, | 772 void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose, |
| 773 mojo::common::mojom::blink::TimeDeltaPtr time, | 773 WTF::TimeDelta time_delta, |
| 774 int16_t frame_id, | 774 int16_t frame_id, |
| 775 device::mojom::blink::VRVSyncProvider::Status error) { | 775 device::mojom::blink::VRVSyncProvider::Status error) { |
| 776 DVLOG(2) << __FUNCTION__; | 776 DVLOG(2) << __FUNCTION__; |
| 777 v_sync_connection_failed_ = false; | 777 v_sync_connection_failed_ = false; |
| 778 switch (error) { | 778 switch (error) { |
| 779 case device::mojom::blink::VRVSyncProvider::Status::SUCCESS: | 779 case device::mojom::blink::VRVSyncProvider::Status::SUCCESS: |
| 780 break; | 780 break; |
| 781 case device::mojom::blink::VRVSyncProvider::Status::CLOSING: | 781 case device::mojom::blink::VRVSyncProvider::Status::CLOSING: |
| 782 return; | 782 return; |
| 783 } | 783 } |
| 784 pending_vsync_ = false; | 784 pending_vsync_ = false; |
| 785 | 785 |
| 786 WTF::TimeDelta time_delta = | |
| 787 WTF::TimeDelta::FromMicroseconds(time->microseconds); | |
| 788 // Ensure a consistent timebase with document rAF. | 786 // Ensure a consistent timebase with document rAF. |
| 789 if (timebase_ < 0) { | 787 if (timebase_ < 0) { |
| 790 timebase_ = WTF::MonotonicallyIncreasingTime() - time_delta.InSecondsF(); | 788 timebase_ = WTF::MonotonicallyIncreasingTime() - time_delta.InSecondsF(); |
| 791 } | 789 } |
| 792 | 790 |
| 793 frame_pose_ = std::move(pose); | 791 frame_pose_ = std::move(pose); |
| 794 vr_frame_id_ = frame_id; | 792 vr_frame_id_ = frame_id; |
| 795 | 793 |
| 796 // Post a task to handle scheduled animations after the current | 794 // Post a task to handle scheduled animations after the current |
| 797 // execution context finishes, so that we yield to non-mojo tasks in | 795 // execution context finishes, so that we yield to non-mojo tasks in |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 visitor->Trace(stage_parameters_); | 879 visitor->Trace(stage_parameters_); |
| 882 visitor->Trace(eye_parameters_left_); | 880 visitor->Trace(eye_parameters_left_); |
| 883 visitor->Trace(eye_parameters_right_); | 881 visitor->Trace(eye_parameters_right_); |
| 884 visitor->Trace(layer_); | 882 visitor->Trace(layer_); |
| 885 visitor->Trace(rendering_context_); | 883 visitor->Trace(rendering_context_); |
| 886 visitor->Trace(scripted_animation_controller_); | 884 visitor->Trace(scripted_animation_controller_); |
| 887 visitor->Trace(pending_present_resolvers_); | 885 visitor->Trace(pending_present_resolvers_); |
| 888 } | 886 } |
| 889 | 887 |
| 890 } // namespace blink | 888 } // namespace blink |
| OLD | NEW |