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

Unified Diff: device/sensors/sensor_manager_android.cc

Issue 2646093002: Move //content/browser/device_sensor/ into device/sensors (Closed)
Patch Set: update git log Created 3 years, 11 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
Index: device/sensors/sensor_manager_android.cc
diff --git a/content/browser/device_sensors/sensor_manager_android.cc b/device/sensors/sensor_manager_android.cc
similarity index 91%
rename from content/browser/device_sensors/sensor_manager_android.cc
rename to device/sensors/sensor_manager_android.cc
index 65f5771148e349e7d2c9e4e73edd62ae518a4bf0..c896e1a78729123ba2a3858f4cec73016e909df9 100644
--- a/content/browser/device_sensors/sensor_manager_android.cc
+++ b/device/sensors/sensor_manager_android.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/device_sensors/sensor_manager_android.h"
+#include "device/sensors/sensor_manager_android.h"
#include <string.h>
@@ -20,13 +20,16 @@ using base::android::JavaParamRef;
namespace {
void UpdateDeviceOrientationHistogram(
- content::SensorManagerAndroid::OrientationSensorType type) {
- UMA_HISTOGRAM_ENUMERATION("InertialSensor.DeviceOrientationSensorAndroid",
- type, content::SensorManagerAndroid::ORIENTATION_SENSOR_MAX);
+ device::SensorManagerAndroid::OrientationSensorType type) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "InertialSensor.DeviceOrientationSensorAndroid", type,
+ device::SensorManagerAndroid::ORIENTATION_SENSOR_MAX);
}
-void SetOrientation(content::DeviceOrientationHardwareBuffer* buffer,
- double alpha, double beta, double gamma) {
+void SetOrientation(device::DeviceOrientationHardwareBuffer* buffer,
+ double alpha,
+ double beta,
+ double gamma) {
buffer->seqlock.WriteBegin();
buffer->data.alpha = alpha;
buffer->data.hasAlpha = true;
@@ -37,9 +40,9 @@ void SetOrientation(content::DeviceOrientationHardwareBuffer* buffer,
buffer->seqlock.WriteEnd();
}
-void SetOrientationBufferStatus(
- content::DeviceOrientationHardwareBuffer* buffer,
- bool ready, bool absolute) {
+void SetOrientationBufferStatus(device::DeviceOrientationHardwareBuffer* buffer,
+ bool ready,
+ bool absolute) {
buffer->seqlock.WriteBegin();
buffer->data.absolute = absolute;
buffer->data.allAvailableSensorsAreActive = ready;
@@ -48,7 +51,7 @@ void SetOrientationBufferStatus(
} // namespace
-namespace content {
+namespace device {
SensorManagerAndroid::SensorManagerAndroid()
: number_active_device_motion_sensors_(0),
@@ -64,8 +67,7 @@ SensorManagerAndroid::SensorManagerAndroid()
AttachCurrentThread(), base::android::GetApplicationContext()));
}
-SensorManagerAndroid::~SensorManagerAndroid() {
-}
+SensorManagerAndroid::~SensorManagerAndroid() {}
bool SensorManagerAndroid::Register(JNIEnv* env) {
return RegisterNativesImpl(env);
@@ -94,7 +96,7 @@ void SensorManagerAndroid::GotOrientation(JNIEnv*,
OrientationSensorType type =
static_cast<OrientationSensorType>(GetOrientationSensorTypeUsed());
SetOrientationBufferStatus(device_orientation_buffer_, true,
- type != GAME_ROTATION_VECTOR);
+ type != GAME_ROTATION_VECTOR);
orientation_buffer_initialized_ = true;
UpdateDeviceOrientationHistogram(type);
}
@@ -329,8 +331,9 @@ void SensorManagerAndroid::StopFetchingDeviceMotionData() {
void SensorManagerAndroid::CheckMotionBufferReadyToRead() {
if (received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION] +
- received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY] +
- received_motion_data_[RECEIVED_MOTION_DATA_ROTATION_RATE] ==
+ received_motion_data_
+ [RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY] +
+ received_motion_data_[RECEIVED_MOTION_DATA_ROTATION_RATE] ==
number_active_device_motion_sensors_) {
device_motion_buffer_->seqlock.WriteBegin();
device_motion_buffer_->data.interval =
@@ -338,13 +341,15 @@ void SensorManagerAndroid::CheckMotionBufferReadyToRead() {
device_motion_buffer_->seqlock.WriteEnd();
SetMotionBufferReadyStatus(true);
- UMA_HISTOGRAM_BOOLEAN("InertialSensor.AccelerometerAndroidAvailable",
+ UMA_HISTOGRAM_BOOLEAN(
+ "InertialSensor.AccelerometerAndroidAvailable",
received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION] > 0);
UMA_HISTOGRAM_BOOLEAN(
"InertialSensor.AccelerometerIncGravityAndroidAvailable",
- received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY]
- > 0);
- UMA_HISTOGRAM_BOOLEAN("InertialSensor.GyroscopeAndroidAvailable",
+ received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY] >
+ 0);
+ UMA_HISTOGRAM_BOOLEAN(
+ "InertialSensor.GyroscopeAndroidAvailable",
received_motion_data_[RECEIVED_MOTION_DATA_ROTATION_RATE] > 0);
}
}
@@ -382,7 +387,7 @@ void SensorManagerAndroid::StartFetchingDeviceOrientationData(
// If Start() was unsuccessful then set the buffer ready flag to true
// to start firing all-null events.
SetOrientationBufferStatus(buffer, !success /* ready */,
- false /* absolute */);
+ false /* absolute */);
orientation_buffer_initialized_ = !success;
}
@@ -424,7 +429,7 @@ void SensorManagerAndroid::StartFetchingDeviceOrientationAbsoluteData(
// If Start() was unsuccessful then set the buffer ready flag to true
// to start firing all-null events.
SetOrientationBufferStatus(buffer, !success /* ready */,
- false /* absolute */);
+ false /* absolute */);
orientation_absolute_buffer_initialized_ = !success;
}
}
@@ -439,7 +444,7 @@ void SensorManagerAndroid::StopFetchingDeviceOrientationAbsoluteData() {
base::AutoLock autolock(orientation_absolute_buffer_lock_);
if (device_orientation_absolute_buffer_) {
SetOrientationBufferStatus(device_orientation_absolute_buffer_, false,
- false);
+ false);
orientation_absolute_buffer_initialized_ = false;
device_orientation_absolute_buffer_ = nullptr;
}
@@ -451,4 +456,4 @@ void SensorManagerAndroid::Shutdown() {
is_shutdown_ = true;
}
-} // namespace content
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698