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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/OrientationSensor.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: add some layout tests Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 double z = readingValueUnchecked(2); 95 double z = readingValueUnchecked(2);
96 double w = readingValueUnchecked(3); 96 double w = readingValueUnchecked(3);
97 97
98 doPopulateMatrix(targetMatrix, x, y, z, w); 98 doPopulateMatrix(targetMatrix, x, y, z, w);
99 } 99 }
100 100
101 void OrientationSensor::populateMatrix( 101 void OrientationSensor::populateMatrix(
102 Float32ArrayOrFloat64ArrayOrDOMMatrix& matrix, 102 Float32ArrayOrFloat64ArrayOrDOMMatrix& matrix,
103 ExceptionState& exceptionState) { 103 ExceptionState& exceptionState) {
104 if (matrix.isFloat32Array()) 104 if (matrix.isFloat32Array())
105 populateMatrixInternal(matrix.getAsFloat32Array(), exceptionState); 105 populateMatrixInternal(matrix.getAsFloat32Array().view(), exceptionState);
106 else if (matrix.isFloat64Array()) 106 else if (matrix.isFloat64Array())
107 populateMatrixInternal(matrix.getAsFloat64Array(), exceptionState); 107 populateMatrixInternal(matrix.getAsFloat64Array().view(), exceptionState);
108 else if (matrix.isDOMMatrix()) 108 else if (matrix.isDOMMatrix())
109 populateMatrixInternal(matrix.getAsDOMMatrix(), exceptionState); 109 populateMatrixInternal(matrix.getAsDOMMatrix(), exceptionState);
110 else 110 else
111 NOTREACHED() << "Unexpected rotation matrix type."; 111 NOTREACHED() << "Unexpected rotation matrix type.";
112 } 112 }
113 113
114 bool OrientationSensor::isReadingDirty() const { 114 bool OrientationSensor::isReadingDirty() const {
115 return m_readingDirty || !canReturnReadings(); 115 return m_readingDirty || !canReturnReadings();
116 } 116 }
117 117
118 OrientationSensor::OrientationSensor(ExecutionContext* executionContext, 118 OrientationSensor::OrientationSensor(ExecutionContext* executionContext,
119 const SensorOptions& options, 119 const SensorOptions& options,
120 ExceptionState& exceptionState, 120 ExceptionState& exceptionState,
121 device::mojom::blink::SensorType type) 121 device::mojom::blink::SensorType type)
122 : Sensor(executionContext, options, exceptionState, type), 122 : Sensor(executionContext, options, exceptionState, type),
123 m_readingDirty(true) {} 123 m_readingDirty(true) {}
124 124
125 void OrientationSensor::onSensorReadingChanged() { 125 void OrientationSensor::onSensorReadingChanged() {
126 m_readingDirty = true; 126 m_readingDirty = true;
127 } 127 }
128 128
129 DEFINE_TRACE(OrientationSensor) { 129 DEFINE_TRACE(OrientationSensor) {
130 Sensor::trace(visitor); 130 Sensor::trace(visitor);
131 } 131 }
132 132
133 } // namespace blink 133 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698