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

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

Issue 2953263002: Revert of Reland: Refactor DeviceMotionEventPump to use //device/generic_sensor instead of //device/sensors (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « device/generic_sensor/DEPS ('k') | device/generic_sensor/sensor_provider_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_provider_android.h" 5 #include "device/generic_sensor/platform_sensor_provider_android.h"
6 6
7 #include "base/android/scoped_java_ref.h" 7 #include "base/android/scoped_java_ref.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "device/generic_sensor/platform_sensor_android.h" 9 #include "device/generic_sensor/platform_sensor_android.h"
10 #include "jni/PlatformSensorProvider_jni.h" 10 #include "jni/PlatformSensorProvider_jni.h"
(...skipping 18 matching lines...) Expand all
29 PlatformSensorProviderAndroid::~PlatformSensorProviderAndroid() = default; 29 PlatformSensorProviderAndroid::~PlatformSensorProviderAndroid() = default;
30 30
31 void PlatformSensorProviderAndroid::CreateSensorInternal( 31 void PlatformSensorProviderAndroid::CreateSensorInternal(
32 mojom::SensorType type, 32 mojom::SensorType type,
33 mojo::ScopedSharedBufferMapping mapping, 33 mojo::ScopedSharedBufferMapping mapping,
34 const CreateSensorCallback& callback) { 34 const CreateSensorCallback& callback) {
35 JNIEnv* env = AttachCurrentThread(); 35 JNIEnv* env = AttachCurrentThread();
36 ScopedJavaLocalRef<jobject> sensor = Java_PlatformSensorProvider_createSensor( 36 ScopedJavaLocalRef<jobject> sensor = Java_PlatformSensorProvider_createSensor(
37 env, j_object_.obj(), static_cast<jint>(type)); 37 env, j_object_.obj(), static_cast<jint>(type));
38 38
39 if (!sensor.obj()) { 39 if (!sensor.obj())
40 callback.Run(nullptr); 40 callback.Run(nullptr);
41 return;
42 }
43 41
44 scoped_refptr<PlatformSensorAndroid> concrete_sensor = 42 scoped_refptr<PlatformSensorAndroid> concrete_sensor =
45 new PlatformSensorAndroid(type, std::move(mapping), this, sensor); 43 new PlatformSensorAndroid(type, std::move(mapping), this, sensor);
46 callback.Run(concrete_sensor); 44 callback.Run(concrete_sensor);
47 } 45 }
48 46
49 } // namespace device 47 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/DEPS ('k') | device/generic_sensor/sensor_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698