Index: third_party/WebKit/Source/modules/vr/VRPositionState.cpp |
diff --git a/third_party/WebKit/Source/modules/vr/VRPositionState.cpp b/third_party/WebKit/Source/modules/vr/VRPositionState.cpp |
index 0d748cb79830d51b51ade0e2b44ac2410f7b76f4..3a2514268bf76afff848c7931c97764cc872eb56 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRPositionState.cpp |
+++ b/third_party/WebKit/Source/modules/vr/VRPositionState.cpp |
@@ -4,21 +4,24 @@ |
#include "modules/vr/VRPositionState.h" |
+#include "bindings/core/v8/GeometryInterfaces.h" |
+ |
namespace blink { |
namespace { |
-DOMPoint* vecToDomPoint(const WebVRVector4& vec, bool valid) |
+void vecToDomPoint(ScriptValue& value, const WebVRVector4& vec, bool valid) |
{ |
if (valid) |
- return DOMPoint::create(vec.x, vec.y, vec.z, vec.w); |
- return nullptr; |
+ value = GeometryInterfaces::createDOMPoint(vec.x, vec.y, vec.z, vec.w); |
+ value = ScriptValue::createNull(ScriptState::current(v8::Isolate::GetCurrent())); |
haraken
2016/02/25 11:21:11
Please don't use ScriptState::current without unde
|
} |
-DOMPoint* vecToDomPoint(const WebVRVector3& vec, bool valid) |
+ |
+void vecToDomPoint(ScriptValue& value, const WebVRVector3& vec, bool valid) |
{ |
if (valid) |
- return DOMPoint::create(vec.x, vec.y, vec.z, 1.0); |
- return nullptr; |
+ value = GeometryInterfaces::createDOMPoint(vec.x, vec.y, vec.z, 1.0); |
+ value = ScriptValue::createNull(ScriptState::current(v8::Isolate::GetCurrent())); |
} |
} // namespace |
@@ -31,22 +34,16 @@ VRPositionState::VRPositionState() |
void VRPositionState::setState(const WebHMDSensorState &state) |
{ |
m_timeStamp = state.timestamp; |
- m_orientation = vecToDomPoint(state.orientation, state.flags & WebVRSensorStateOrientation); |
- m_position = vecToDomPoint(state.position, state.flags & WebVRSensorStatePosition); |
- m_angularVelocity = vecToDomPoint(state.angularVelocity, state.flags & WebVRSensorStateAngularVelocity); |
- m_linearVelocity = vecToDomPoint(state.linearVelocity, state.flags & WebVRSensorStateLinearVelocity); |
- m_angularAcceleration = vecToDomPoint(state.angularAcceleration, state.flags & WebVRSensorStateAngularAcceleration); |
- m_linearAcceleration = vecToDomPoint(state.linearAcceleration, state.flags & WebVRSensorStateLinearAcceleration); |
+ vecToDomPoint(m_orientation, state.orientation, state.flags & WebVRSensorStateOrientation); |
domenic
2016/02/24 21:23:04
Is using references in this way OK according to Bl
|
+ vecToDomPoint(m_position, state.position, state.flags & WebVRSensorStatePosition); |
+ vecToDomPoint(m_angularVelocity, state.angularVelocity, state.flags & WebVRSensorStateAngularVelocity); |
+ vecToDomPoint(m_linearVelocity, state.linearVelocity, state.flags & WebVRSensorStateLinearVelocity); |
+ vecToDomPoint(m_angularAcceleration, state.angularAcceleration, state.flags & WebVRSensorStateAngularAcceleration); |
+ vecToDomPoint(m_linearAcceleration, state.linearAcceleration, state.flags & WebVRSensorStateLinearAcceleration); |
} |
DEFINE_TRACE(VRPositionState) |
{ |
- visitor->trace(m_orientation); |
- visitor->trace(m_position); |
- visitor->trace(m_angularVelocity); |
- visitor->trace(m_linearVelocity); |
- visitor->trace(m_angularAcceleration); |
- visitor->trace(m_linearAcceleration); |
} |
} // namespace blink |