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

Side by Side Diff: device/generic_sensor/platform_sensor_android.cc

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comment from Tim 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 "device/generic_sensor/platform_sensor_android.h" 5 #include "device/generic_sensor/platform_sensor_android.h"
6 6
7 #include "base/android/context_utils.h" 7 #include "base/android/context_utils.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "jni/PlatformSensor_jni.h" 9 #include "jni/PlatformSensor_jni.h"
10 10
(...skipping 30 matching lines...) Expand all
41 Java_PlatformSensor_getReportingMode(env, j_object_.obj())); 41 Java_PlatformSensor_getReportingMode(env, j_object_.obj()));
42 } 42 }
43 43
44 PlatformSensorConfiguration PlatformSensorAndroid::GetDefaultConfiguration() { 44 PlatformSensorConfiguration PlatformSensorAndroid::GetDefaultConfiguration() {
45 JNIEnv* env = AttachCurrentThread(); 45 JNIEnv* env = AttachCurrentThread();
46 jdouble frequency = 46 jdouble frequency =
47 Java_PlatformSensor_getDefaultConfiguration(env, j_object_.obj()); 47 Java_PlatformSensor_getDefaultConfiguration(env, j_object_.obj());
48 return PlatformSensorConfiguration(frequency); 48 return PlatformSensorConfiguration(frequency);
49 } 49 }
50 50
51 double PlatformSensorAndroid::GetMaximumSupportedFrequency() {
52 JNIEnv* env = AttachCurrentThread();
53 return Java_PlatformSensor_getMaximumSupportedFrequency(env, j_object_.obj());
54 }
55
51 bool PlatformSensorAndroid::StartSensor( 56 bool PlatformSensorAndroid::StartSensor(
52 const PlatformSensorConfiguration& configuration) { 57 const PlatformSensorConfiguration& configuration) {
53 JNIEnv* env = AttachCurrentThread(); 58 JNIEnv* env = AttachCurrentThread();
54 return Java_PlatformSensor_startSensor(env, j_object_.obj(), 59 return Java_PlatformSensor_startSensor(env, j_object_.obj(),
55 configuration.frequency()); 60 configuration.frequency());
56 } 61 }
57 62
58 void PlatformSensorAndroid::StopSensor() { 63 void PlatformSensorAndroid::StopSensor() {
59 JNIEnv* env = AttachCurrentThread(); 64 JNIEnv* env = AttachCurrentThread();
60 Java_PlatformSensor_stopSensor(env, j_object_.obj()); 65 Java_PlatformSensor_stopSensor(env, j_object_.obj());
(...skipping 24 matching lines...) Expand all
85 reading.timestamp = timestamp; 90 reading.timestamp = timestamp;
86 reading.values[0] = value1; 91 reading.values[0] = value1;
87 reading.values[1] = value2; 92 reading.values[1] = value2;
88 reading.values[2] = value3; 93 reading.values[2] = value3;
89 94
90 bool needNotify = (GetReportingMode() == mojom::ReportingMode::ON_CHANGE); 95 bool needNotify = (GetReportingMode() == mojom::ReportingMode::ON_CHANGE);
91 UpdateSensorReading(reading, needNotify); 96 UpdateSensorReading(reading, needNotify);
92 } 97 }
93 98
94 } // namespace device 99 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor_android.h ('k') | device/generic_sensor/platform_sensor_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698