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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 double z = ReadingValueUnchecked(2); | 100 double z = ReadingValueUnchecked(2); |
101 double w = ReadingValueUnchecked(3); | 101 double w = ReadingValueUnchecked(3); |
102 | 102 |
103 DoPopulateMatrix(target_matrix, x, y, z, w); | 103 DoPopulateMatrix(target_matrix, x, y, z, w); |
104 } | 104 } |
105 | 105 |
106 void OrientationSensor::populateMatrix( | 106 void OrientationSensor::populateMatrix( |
107 Float32ArrayOrFloat64ArrayOrDOMMatrix& matrix, | 107 Float32ArrayOrFloat64ArrayOrDOMMatrix& matrix, |
108 ExceptionState& exception_state) { | 108 ExceptionState& exception_state) { |
109 if (matrix.isFloat32Array()) | 109 if (matrix.isFloat32Array()) |
110 PopulateMatrixInternal(matrix.getAsFloat32Array(), exception_state); | 110 PopulateMatrixInternal(matrix.getAsFloat32Array().View(), exception_state); |
111 else if (matrix.isFloat64Array()) | 111 else if (matrix.isFloat64Array()) |
112 PopulateMatrixInternal(matrix.getAsFloat64Array(), exception_state); | 112 PopulateMatrixInternal(matrix.getAsFloat64Array().View(), exception_state); |
113 else if (matrix.isDOMMatrix()) | 113 else if (matrix.isDOMMatrix()) |
114 PopulateMatrixInternal(matrix.getAsDOMMatrix(), exception_state); | 114 PopulateMatrixInternal(matrix.getAsDOMMatrix(), exception_state); |
115 else | 115 else |
116 NOTREACHED() << "Unexpected rotation matrix type."; | 116 NOTREACHED() << "Unexpected rotation matrix type."; |
117 } | 117 } |
118 | 118 |
119 bool OrientationSensor::isReadingDirty() const { | 119 bool OrientationSensor::isReadingDirty() const { |
120 return reading_dirty_ || !CanReturnReadings(); | 120 return reading_dirty_ || !CanReturnReadings(); |
121 } | 121 } |
122 | 122 |
123 OrientationSensor::OrientationSensor(ExecutionContext* execution_context, | 123 OrientationSensor::OrientationSensor(ExecutionContext* execution_context, |
124 const SensorOptions& options, | 124 const SensorOptions& options, |
125 ExceptionState& exception_state, | 125 ExceptionState& exception_state, |
126 device::mojom::blink::SensorType type) | 126 device::mojom::blink::SensorType type) |
127 : Sensor(execution_context, options, exception_state, type), | 127 : Sensor(execution_context, options, exception_state, type), |
128 reading_dirty_(true) {} | 128 reading_dirty_(true) {} |
129 | 129 |
130 void OrientationSensor::OnSensorReadingChanged() { | 130 void OrientationSensor::OnSensorReadingChanged() { |
131 reading_dirty_ = true; | 131 reading_dirty_ = true; |
132 } | 132 } |
133 | 133 |
134 DEFINE_TRACE(OrientationSensor) { | 134 DEFINE_TRACE(OrientationSensor) { |
135 Sensor::Trace(visitor); | 135 Sensor::Trace(visitor); |
136 } | 136 } |
137 | 137 |
138 } // namespace blink | 138 } // namespace blink |
OLD | NEW |