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

Unified Diff: device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java

Issue 2860633003: Remove redundant static singleton for DeviceSensors (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/sensors/sensor_manager_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
diff --git a/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java b/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
index 7360756cd18e4c196582fa99133aa90349371b9b..268c04d29d73af90e421959a2564ba35fdaccdc6 100644
--- a/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
+++ b/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
@@ -4,7 +4,6 @@
package org.chromium.device.sensors;
-import android.annotation.SuppressLint;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
@@ -67,11 +66,6 @@ class DeviceSensors implements SensorEventListener {
// Lazily initialized when registering for notifications.
private SensorManagerProxy mSensorManagerProxy;
- // The only instance of that class and its associated lock.
- @SuppressLint("StaticFieldLeak")
- private static DeviceSensors sSingleton;
- private static Object sSingletonLock = new Object();
-
static final Set<Integer> DEVICE_ORIENTATION_SENSORS_A =
CollectionUtil.newHashSet(Sensor.TYPE_GAME_ROTATION_VECTOR);
static final Set<Integer> DEVICE_ORIENTATION_SENSORS_B =
@@ -571,13 +565,8 @@ class DeviceSensors implements SensorEventListener {
}
@CalledByNative
- static DeviceSensors getInstance(Context appContext) {
- synchronized (sSingletonLock) {
- if (sSingleton == null) {
- sSingleton = new DeviceSensors(appContext);
- }
- return sSingleton;
- }
+ static DeviceSensors create(Context appContext) {
+ return new DeviceSensors(appContext);
}
/**
« no previous file with comments | « no previous file | device/sensors/sensor_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698