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/PressureSensor.h" |
| 6 |
| 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "modules/sensor/PressureSensorReading.h" |
| 10 |
| 11 using device::sensors::blink::SensorType; |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 PressureSensor* PressureSensor::create(ExecutionContext* context, const SensorOp
tions& sensorOptions, ExceptionState& exceptionState) |
| 16 { |
| 17 PressureSensor* sensor = new PressureSensor(context, sensorOptions); |
| 18 sensor->suspendIfNeeded(); |
| 19 return sensor; |
| 20 } |
| 21 |
| 22 // static |
| 23 PressureSensor* PressureSensor::create(ExecutionContext* context, ExceptionState
& exceptionState) |
| 24 { |
| 25 return create(context, SensorOptions(), exceptionState); |
| 26 } |
| 27 |
| 28 PressureSensor::PressureSensor(ExecutionContext* executionContext, const SensorO
ptions& sensorOptions) |
| 29 : Sensor(executionContext, sensorOptions, SensorType::PRESSURE) |
| 30 { |
| 31 } |
| 32 |
| 33 PressureSensorReading* PressureSensor::reading() const |
| 34 { |
| 35 return static_cast<PressureSensorReading*>(Sensor::reading()); |
| 36 } |
| 37 |
| 38 SensorReading* PressureSensor::createSensorReading() |
| 39 { |
| 40 ASSERT(controller()); |
| 41 return PressureSensorReading::create(controller()); |
| 42 } |
| 43 |
| 44 device::sensors::blink::SensorConfigurationPtr PressureSensor::createSensorOptio
ns() |
| 45 { |
| 46 auto result = device::sensors::blink::SensorConfiguration::New(); |
| 47 if (options().hasFrequency()) |
| 48 result->frequency = options().frequency(); |
| 49 return result; |
| 50 } |
| 51 |
| 52 DEFINE_TRACE(PressureSensor) |
| 53 { |
| 54 Sensor::trace(visitor); |
| 55 } |
| 56 |
| 57 } // namespace blink |
OLD | NEW |