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

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

Issue 2506903003: [sensors] Gyroscope sensor bindings implementation (Closed)
Patch Set: Created 4 years, 1 month 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
(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/Gyroscope.h"
6
7 #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.
8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "modules/sensor/GyroscopeReading.h"
10
11 using device::mojom::blink::SensorType;
12
13 namespace blink {
14
15 Gyroscope* Gyroscope::create(ScriptState* scriptState,
16 const SensorOptions& options,
17 ExceptionState& exceptionState) {
18 return new Gyroscope(scriptState, options, exceptionState);
19 }
20
21 // static
22 Gyroscope* Gyroscope::create(ScriptState* scriptState,
23 ExceptionState& exceptionState) {
24 return create(scriptState, SensorOptions(), exceptionState);
25 }
26
27 Gyroscope::Gyroscope(ScriptState* scriptState,
28 const SensorOptions& options,
29 ExceptionState& exceptionState)
30 : Sensor(scriptState, options, exceptionState, SensorType::GYROSCOPE) {}
31
32 GyroscopeReading* Gyroscope::reading() const {
33 return static_cast<GyroscopeReading*>(Sensor::reading());
34 }
35
36 std::unique_ptr<SensorReadingFactory> Gyroscope::createSensorReadingFactory() {
37 return std::unique_ptr<SensorReadingFactory>(
38 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.
39 }
40
41 DEFINE_TRACE(Gyroscope) {
42 Sensor::trace(visitor);
43 }
44
45 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698