OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/Gyroscope.h" | 5 #include "modules/sensor/Gyroscope.h" |
6 | 6 |
7 #include "modules/sensor/GyroscopeReading.h" | 7 #include "modules/sensor/GyroscopeReading.h" |
8 | 8 |
9 using device::mojom::blink::SensorType; | 9 using device::mojom::blink::SensorType; |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 Gyroscope* Gyroscope::create(ScriptState* scriptState, | 13 Gyroscope* Gyroscope::create(ExecutionContext* executionContext, |
14 const SensorOptions& options, | 14 const SensorOptions& options, |
15 ExceptionState& exceptionState) { | 15 ExceptionState& exceptionState) { |
16 return new Gyroscope(scriptState, options, exceptionState); | 16 return new Gyroscope(executionContext, options, exceptionState); |
17 } | 17 } |
18 | 18 |
19 // static | 19 // static |
20 Gyroscope* Gyroscope::create(ScriptState* scriptState, | 20 Gyroscope* Gyroscope::create(ExecutionContext* executionContext, |
21 ExceptionState& exceptionState) { | 21 ExceptionState& exceptionState) { |
22 return create(scriptState, SensorOptions(), exceptionState); | 22 return create(executionContext, SensorOptions(), exceptionState); |
23 } | 23 } |
24 | 24 |
25 Gyroscope::Gyroscope(ScriptState* scriptState, | 25 Gyroscope::Gyroscope(ExecutionContext* executionContext, |
26 const SensorOptions& options, | 26 const SensorOptions& options, |
27 ExceptionState& exceptionState) | 27 ExceptionState& exceptionState) |
28 : Sensor(scriptState, options, exceptionState, SensorType::GYROSCOPE) {} | 28 : Sensor(executionContext, options, exceptionState, SensorType::GYROSCOPE) { |
| 29 } |
29 | 30 |
30 GyroscopeReading* Gyroscope::reading() const { | 31 GyroscopeReading* Gyroscope::reading() const { |
31 return static_cast<GyroscopeReading*>(Sensor::reading()); | 32 return static_cast<GyroscopeReading*>(Sensor::reading()); |
32 } | 33 } |
33 | 34 |
34 std::unique_ptr<SensorReadingFactory> Gyroscope::createSensorReadingFactory() { | 35 std::unique_ptr<SensorReadingFactory> Gyroscope::createSensorReadingFactory() { |
35 return makeUnique<SensorReadingFactoryImpl<GyroscopeReading>>(); | 36 return makeUnique<SensorReadingFactoryImpl<GyroscopeReading>>(); |
36 } | 37 } |
37 | 38 |
38 DEFINE_TRACE(Gyroscope) { | 39 DEFINE_TRACE(Gyroscope) { |
39 Sensor::trace(visitor); | 40 Sensor::trace(visitor); |
40 } | 41 } |
41 | 42 |
42 } // namespace blink | 43 } // namespace blink |
OLD | NEW |