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

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

Issue 2533383002: Adjust the timestamp for VRDisplay.requestAnimationFrame calls (Closed)
Patch Set: Created 4 years, 1 month 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..1d45082912eccf07e8219c64afe0dfc2c8b31ed7 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"
@@ -45,7 +46,15 @@ class VRDisplayFrameRequestCallback : public FrameRequestCallback {
: m_vrDisplay(vrDisplay) {}
~VRDisplayFrameRequestCallback() override {}
void handleEvent(double highResTimeMs) override {
- m_vrDisplay->serviceScriptedAnimations(highResTimeMs);
+ Document* doc = m_vrDisplay->document();
+ if (!doc)
+ return;
+
+ // Need to devide by 1000 here because serviceScriptedAnimations expects
cjgrant 2016/11/29 20:02:02 divide
+ // time to be given in seconds.
+ m_vrDisplay->serviceScriptedAnimations(
+ doc->loader()->timing().pseudoWallTimeToMonotonicTime(highResTimeMs /
+ 1000.0));
}
DEFINE_INLINE_VIRTUAL_TRACE() {
@@ -187,7 +196,7 @@ int VRDisplay::requestAnimationFrame(FrameRequestCallback* callback) {
m_animationCallbackRequested = true;
}
- callback->m_useLegacyTimeBase = false;
+ callback->m_useLegacyTimeBase = true;
klausw 2016/11/29 20:50:27 Why are you changing this too? Add a comment?
return ensureScriptedAnimationController(doc).registerCallback(callback);
}
@@ -604,6 +613,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