| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/sensor/OrientationSensor.h" | 5 #include "modules/sensor/OrientationSensor.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/geometry/DOMMatrix.h" | 8 #include "core/geometry/DOMMatrix.h" |
| 9 | 9 |
| 10 using device::mojom::blink::SensorType; | 10 using device::mojom::blink::SensorType; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 double z = readingValueUnchecked(2); | 97 double z = readingValueUnchecked(2); |
| 98 double w = readingValueUnchecked(3); | 98 double w = readingValueUnchecked(3); |
| 99 | 99 |
| 100 doPopulateMatrix(targetMatrix, x, y, z, w); | 100 doPopulateMatrix(targetMatrix, x, y, z, w); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void OrientationSensor::populateMatrix( | 103 void OrientationSensor::populateMatrix( |
| 104 Float32ArrayOrFloat64ArrayOrDOMMatrix& matrix, | 104 Float32ArrayOrFloat64ArrayOrDOMMatrix& matrix, |
| 105 ExceptionState& exceptionState) { | 105 ExceptionState& exceptionState) { |
| 106 if (matrix.isFloat32Array()) | 106 if (matrix.isFloat32Array()) |
| 107 populateMatrixInternal(matrix.getAsFloat32Array(), exceptionState); | 107 populateMatrixInternal(matrix.getAsFloat32Array().view(), exceptionState); |
| 108 else if (matrix.isFloat64Array()) | 108 else if (matrix.isFloat64Array()) |
| 109 populateMatrixInternal(matrix.getAsFloat64Array(), exceptionState); | 109 populateMatrixInternal(matrix.getAsFloat64Array().view(), exceptionState); |
| 110 else if (matrix.isDOMMatrix()) | 110 else if (matrix.isDOMMatrix()) |
| 111 populateMatrixInternal(matrix.getAsDOMMatrix(), exceptionState); | 111 populateMatrixInternal(matrix.getAsDOMMatrix(), exceptionState); |
| 112 else | 112 else |
| 113 NOTREACHED() << "Unexpected rotation matrix type."; | 113 NOTREACHED() << "Unexpected rotation matrix type."; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool OrientationSensor::isReadingDirty() const { | 116 bool OrientationSensor::isReadingDirty() const { |
| 117 return m_readingDirty || !canReturnReadings(); | 117 return m_readingDirty || !canReturnReadings(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 OrientationSensor::OrientationSensor(ExecutionContext* executionContext, | 120 OrientationSensor::OrientationSensor(ExecutionContext* executionContext, |
| 121 const SensorOptions& options, | 121 const SensorOptions& options, |
| 122 ExceptionState& exceptionState, | 122 ExceptionState& exceptionState, |
| 123 device::mojom::blink::SensorType type) | 123 device::mojom::blink::SensorType type) |
| 124 : Sensor(executionContext, options, exceptionState, type), | 124 : Sensor(executionContext, options, exceptionState, type), |
| 125 m_readingDirty(true) {} | 125 m_readingDirty(true) {} |
| 126 | 126 |
| 127 void OrientationSensor::onSensorReadingChanged() { | 127 void OrientationSensor::onSensorReadingChanged() { |
| 128 m_readingDirty = true; | 128 m_readingDirty = true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 DEFINE_TRACE(OrientationSensor) { | 131 DEFINE_TRACE(OrientationSensor) { |
| 132 Sensor::trace(visitor); | 132 Sensor::trace(visitor); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |