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

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

Issue 2395853003: [Sensors] Improvements in shared buffer managing (Closed)
Patch Set: Test compilation fix + comment from Ken Created 4 years, 2 months 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 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_ 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_ 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_
7 7
8 #include "device/generic_sensor/platform_sensor.h" 8 #include "device/generic_sensor/platform_sensor.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 11
12 namespace base { 12 namespace base {
13 class SingleThreadTaskRunner; 13 class SingleThreadTaskRunner;
14 } 14 }
15 15
16 namespace device { 16 namespace device {
17 17
18 class PlatformSensorAndroid : public PlatformSensor { 18 class PlatformSensorAndroid : public PlatformSensor {
19 public: 19 public:
20 // Register C++ methods exposed to Java using JNI. 20 // Register C++ methods exposed to Java using JNI.
21 static bool RegisterJNI(JNIEnv* env); 21 static bool RegisterJNI(JNIEnv* env);
22 22
23 PlatformSensorAndroid(mojom::SensorType type, 23 PlatformSensorAndroid(mojom::SensorType type,
24 mojo::ScopedSharedBufferMapping mapping, 24 mojo::ScopedSharedBufferMapping mapping,
25 uint64_t buffer_size,
26 PlatformSensorProvider* provider, 25 PlatformSensorProvider* provider,
27 const base::android::JavaRef<jobject>& java_sensor); 26 const base::android::JavaRef<jobject>& java_sensor);
28 27
29 mojom::ReportingMode GetReportingMode() override; 28 mojom::ReportingMode GetReportingMode() override;
30 PlatformSensorConfiguration GetDefaultConfiguration() override; 29 PlatformSensorConfiguration GetDefaultConfiguration() override;
31 30
32 void NotifyPlatformSensorReadingChanged(
33 JNIEnv*,
34 const base::android::JavaRef<jobject>& caller);
35 void NotifyPlatformSensorError(JNIEnv*, 31 void NotifyPlatformSensorError(JNIEnv*,
36 const base::android::JavaRef<jobject>& caller); 32 const base::android::JavaRef<jobject>& caller);
37 33
34 void UpdatePlatformSensorReading(
35 JNIEnv*,
36 const base::android::JavaRef<jobject>& caller,
37 jdouble timestamp,
38 jdouble value1,
39 jdouble value2,
40 jdouble value3);
41
38 protected: 42 protected:
39 ~PlatformSensorAndroid() override; 43 ~PlatformSensorAndroid() override;
40 bool StartSensor(const PlatformSensorConfiguration& configuration) override; 44 bool StartSensor(const PlatformSensorConfiguration& configuration) override;
41 void StopSensor() override; 45 void StopSensor() override;
42 bool CheckSensorConfiguration( 46 bool CheckSensorConfiguration(
43 const PlatformSensorConfiguration& configuration) override; 47 const PlatformSensorConfiguration& configuration) override;
44 48
45 private: 49 private:
46 // Java object org.chromium.device.sensors.PlatformSensor 50 // Java object org.chromium.device.sensors.PlatformSensor
47 base::android::ScopedJavaGlobalRef<jobject> j_object_; 51 base::android::ScopedJavaGlobalRef<jobject> j_object_;
48 // Task runner that is used by mojo objects for the IPC. Android sensor
49 // objects share separate handler thread that processes sensor
50 // events. Notifications from Java side are forwarded to |task_runner_|.
51 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
52 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAndroid); 52 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAndroid);
53 }; 53 };
54 54
55 } // namespace device 55 } // namespace device
56 56
57 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_ 57 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor.cc ('k') | device/generic_sensor/platform_sensor_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698