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

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

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comments from Alex 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
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/AmbientLightSensor.h" 5 #include "modules/sensor/AmbientLightSensor.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "modules/sensor/AmbientLightSensorReading.h" 9 #include "modules/sensor/AmbientLightSensorReading.h"
10 10
(...skipping 20 matching lines...) Expand all
31 : Sensor(scriptState, options, exceptionState, SensorType::AMBIENT_LIGHT) {} 31 : Sensor(scriptState, options, exceptionState, SensorType::AMBIENT_LIGHT) {}
32 32
33 AmbientLightSensorReading* AmbientLightSensor::reading() const { 33 AmbientLightSensorReading* AmbientLightSensor::reading() const {
34 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); 34 return static_cast<AmbientLightSensorReading*>(Sensor::reading());
35 } 35 }
36 36
37 SensorReading* AmbientLightSensor::createSensorReading(SensorProxy* proxy) { 37 SensorReading* AmbientLightSensor::createSensorReading(SensorProxy* proxy) {
38 return AmbientLightSensorReading::create(proxy); 38 return AmbientLightSensorReading::create(proxy);
39 } 39 }
40 40
41 auto AmbientLightSensor::createSensorConfig(
42 const SensorOptions& options,
43 const SensorConfiguration& defaultConfig) -> SensorConfigurationPtr {
44 auto result = device::mojom::blink::SensorConfiguration::New();
45 result->frequency =
46 options.hasFrequency() ? options.frequency() : defaultConfig.frequency;
47 return result;
48 }
49
50 DEFINE_TRACE(AmbientLightSensor) { 41 DEFINE_TRACE(AmbientLightSensor) {
51 Sensor::trace(visitor); 42 Sensor::trace(visitor);
52 } 43 }
53 44
54 } // namespace blink 45 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698