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

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

Issue 1918143007: Updated Blink WebVR interfaces to WebVR v1 spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webvr_mojo
Patch Set: Fixed layout test Created 4 years, 7 months 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
Index: third_party/WebKit/Source/modules/vr/VRHardwareUnit.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRHardwareUnit.cpp b/third_party/WebKit/Source/modules/vr/VRHardwareUnit.cpp
deleted file mode 100644
index fda64c730f57fdb87f80cb6b21f38e4d8ab055bc..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/modules/vr/VRHardwareUnit.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "modules/vr/VRHardwareUnit.h"
-
-#include "modules/vr/HMDVRDevice.h"
-#include "modules/vr/NavigatorVRDevice.h"
-#include "modules/vr/PositionSensorVRDevice.h"
-#include "modules/vr/VRController.h"
-#include "modules/vr/VRDevice.h"
-#include "public/platform/Platform.h"
-
-namespace blink {
-
-VRHardwareUnit::VRHardwareUnit(NavigatorVRDevice* navigatorVRDevice)
- : m_nextDeviceId(1)
- , m_frameIndex(0)
- , m_navigatorVRDevice(navigatorVRDevice)
- , m_canUpdatePositionState(true)
-{
- m_positionState = VRPositionState::create();
-}
-
-VRHardwareUnit::~VRHardwareUnit()
-{
- if (!m_canUpdatePositionState)
- Platform::current()->currentThread()->removeTaskObserver(this);
-}
-
-void VRHardwareUnit::updateFromWebVRDevice(const WebVRDevice& device)
-{
- m_index = device.index;
- m_hardwareUnitId = String::number(device.index);
-
- if (device.flags & WebVRDeviceTypeHMD) {
- if (!m_hmd)
- m_hmd = new HMDVRDevice(this, m_nextDeviceId++);
- m_hmd->updateFromWebVRDevice(device);
- } else if (m_hmd) {
- m_hmd.clear();
- }
-
- if (device.flags & WebVRDeviceTypePosition) {
- if (!m_positionSensor)
- m_positionSensor = new PositionSensorVRDevice(this, m_nextDeviceId++);
- m_positionSensor->updateFromWebVRDevice(device);
- } else if (m_positionSensor) {
- m_positionSensor.clear();
- }
-}
-
-void VRHardwareUnit::addDevicesToVector(HeapVector<Member<VRDevice>>& vrDevices)
-{
- if (m_hmd)
- vrDevices.append(m_hmd);
-
- if (m_positionSensor)
- vrDevices.append(m_positionSensor);
-}
-
-VRController* VRHardwareUnit::controller()
-{
- return m_navigatorVRDevice->controller();
-}
-
-VRPositionState* VRHardwareUnit::getSensorState()
-{
- if (m_canUpdatePositionState) {
- m_positionState = getImmediateSensorState(true);
- Platform::current()->currentThread()->addTaskObserver(this);
- m_canUpdatePositionState = false;
- }
-
- return m_positionState;
-}
-
-VRPositionState* VRHardwareUnit::getImmediateSensorState(bool updateFrameIndex)
-{
- WebHMDSensorState state;
- controller()->getSensorState(m_index, state);
- if (updateFrameIndex)
- m_frameIndex = state.frameIndex;
-
- VRPositionState* immediatePositionState = VRPositionState::create();
- immediatePositionState->setState(state);
- return immediatePositionState;
-}
-
-
-void VRHardwareUnit::didProcessTask()
-{
- // State should be stable until control is returned to the user agent.
- if (!m_canUpdatePositionState) {
- Platform::current()->currentThread()->removeTaskObserver(this);
- m_canUpdatePositionState = true;
- }
-}
-
-DEFINE_TRACE(VRHardwareUnit)
-{
- visitor->trace(m_navigatorVRDevice);
- visitor->trace(m_positionState);
- visitor->trace(m_hmd);
- visitor->trace(m_positionSensor);
-}
-
-} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRHardwareUnit.h ('k') | third_party/WebKit/Source/modules/vr/VRHardwareUnitCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698