Chromium Code Reviews| Index: third_party/WebKit/Source/modules/sensor/Gyroscope.cpp |
| diff --git a/third_party/WebKit/Source/modules/sensor/Gyroscope.cpp b/third_party/WebKit/Source/modules/sensor/Gyroscope.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..575044e5ea087e0da1dabd50bb8e6ddfab1328e0 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/sensor/Gyroscope.cpp |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "modules/sensor/Gyroscope.h" |
| + |
| +#include "bindings/core/v8/ScriptPromise.h" |
|
shalamov
2016/11/16 14:38:20
nit: ScriptPromise.h and ScriptPromiseResolver.h a
Mikhail
2016/11/17 13:47:46
Done.
|
| +#include "bindings/core/v8/ScriptPromiseResolver.h" |
| +#include "modules/sensor/GyroscopeReading.h" |
| + |
| +using device::mojom::blink::SensorType; |
| + |
| +namespace blink { |
| + |
| +Gyroscope* Gyroscope::create(ScriptState* scriptState, |
| + const SensorOptions& options, |
| + ExceptionState& exceptionState) { |
| + return new Gyroscope(scriptState, options, exceptionState); |
| +} |
| + |
| +// static |
| +Gyroscope* Gyroscope::create(ScriptState* scriptState, |
| + ExceptionState& exceptionState) { |
| + return create(scriptState, SensorOptions(), exceptionState); |
| +} |
| + |
| +Gyroscope::Gyroscope(ScriptState* scriptState, |
| + const SensorOptions& options, |
| + ExceptionState& exceptionState) |
| + : Sensor(scriptState, options, exceptionState, SensorType::GYROSCOPE) {} |
| + |
| +GyroscopeReading* Gyroscope::reading() const { |
| + return static_cast<GyroscopeReading*>(Sensor::reading()); |
| +} |
| + |
| +std::unique_ptr<SensorReadingFactory> Gyroscope::createSensorReadingFactory() { |
| + return std::unique_ptr<SensorReadingFactory>( |
| + new SensorReadingFactoryImpl<GyroscopeReading>()); |
|
Reilly Grant (use Gerrit)
2016/11/16 18:50:51
As haraken@ suggested on the other review, use mak
Mikhail
2016/11/17 13:47:46
Done.
|
| +} |
| + |
| +DEFINE_TRACE(Gyroscope) { |
| + Sensor::trace(visitor); |
| +} |
| + |
| +} // namespace blink |