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

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

Issue 2544553002: Adjust the timestamp for VRDisplay.requestAnimationFrame calls (Closed)
Patch Set: Created 4 years 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 a266f43d9b194bc884955d27c1c2187d10041e79..e6515a2eda78795122935ded775a9c85d462cb79 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -12,6 +12,7 @@
#include "core/dom/ScriptedAnimationController.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/ConsoleMessage.h"
+#include "core/loader/DocumentLoader.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "modules/vr/NavigatorVR.h"
#include "modules/vr/VRController.h"
@@ -41,11 +42,20 @@ VREye stringToVREye(const String& whichEye) {
class VRDisplayFrameRequestCallback : public FrameRequestCallback {
public:
- VRDisplayFrameRequestCallback(VRDisplay* vrDisplay)
- : m_vrDisplay(vrDisplay) {}
+ VRDisplayFrameRequestCallback(VRDisplay* vrDisplay) : m_vrDisplay(vrDisplay) {
+ m_useLegacyTimeBase = true;
+ }
~VRDisplayFrameRequestCallback() override {}
void handleEvent(double highResTimeMs) override {
- m_vrDisplay->serviceScriptedAnimations(highResTimeMs);
+ Document* doc = m_vrDisplay->document();
+ if (!doc)
+ return;
+
+ // Need to divide by 1000 here because serviceScriptedAnimations expects
+ // time to be given in seconds.
+ m_vrDisplay->serviceScriptedAnimations(
+ doc->loader()->timing().pseudoWallTimeToMonotonicTime(highResTimeMs /
+ 1000.0));
}
DEFINE_INLINE_VIRTUAL_TRACE() {
@@ -604,6 +614,10 @@ void VRDisplay::submitFrame() {
m_canUpdateFramePose = true;
}
+Document* VRDisplay::document() {
+ return m_navigatorVR->document();
+}
+
void VRDisplay::OnPresentChange() {
m_navigatorVR->enqueueVREvent(VRDisplayEvent::create(
EventTypeNames::vrdisplaypresentchange, true, false, this, ""));
« 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