Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "modules/sensor/Magnetometer.h" | |
| 6 | |
| 7 #include "modules/sensor/MagnetometerReading.h" | |
| 8 | |
| 9 using device::mojom::blink::SensorType; | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 // static | |
| 14 Magnetometer* Magnetometer::create(ScriptState* scriptState, | |
| 15 const SensorOptions& options, | |
| 16 ExceptionState& exceptionState) { | |
| 17 return new Magnetometer(scriptState, options, exceptionState); | |
| 18 } | |
| 19 | |
| 20 // static | |
| 21 Magnetometer* Magnetometer::create(ScriptState* scriptState, | |
| 22 ExceptionState& exceptionState) { | |
| 23 return create(scriptState, SensorOptions(), exceptionState); | |
| 24 } | |
| 25 | |
| 26 Magnetometer::Magnetometer(ScriptState* scriptState, | |
| 27 const SensorOptions& options, | |
| 28 ExceptionState& exceptionState) | |
| 29 : Sensor(scriptState, options, exceptionState, SensorType::MAGNETOMETER) {} | |
| 30 | |
| 31 MagnetometerReading* Magnetometer::reading() const { | |
| 32 return static_cast<MagnetometerReading*>(Sensor::reading()); | |
| 33 } | |
| 34 | |
| 35 std::unique_ptr<SensorReadingFactory> | |
| 36 Magnetometer::createSensorReadingFactory() { | |
| 37 return std::unique_ptr<SensorReadingFactory>( | |
| 38 new SensorReadingFactoryImpl<MagnetometerReading>()); | |
|
haraken
2016/11/16 17:33:02
Use makeUnique.
| |
| 39 } | |
| 40 | |
| 41 DEFINE_TRACE(Magnetometer) { | |
| 42 Sensor::trace(visitor); | |
| 43 } | |
| 44 | |
| 45 } // namespace blink | |
| OLD | NEW |