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

Unified Diff: content/browser/device_sensors/device_sensor_service.cc

Issue 2126443002: Rename DeviceInertialSensorService to DeviceSensorService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@conversion--sensors
Patch Set: rebase Created 4 years, 5 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: content/browser/device_sensors/device_sensor_service.cc
diff --git a/content/browser/device_sensors/device_inertial_sensor_service.cc b/content/browser/device_sensors/device_sensor_service.cc
similarity index 67%
rename from content/browser/device_sensors/device_inertial_sensor_service.cc
rename to content/browser/device_sensors/device_sensor_service.cc
index 2ae3881db48fecb52d45c55c8fdff7c93c21c8ac..827600740f7c4bf3355020a3fbe8c85e782f53ee 100644
--- a/content/browser/device_sensors/device_inertial_sensor_service.cc
+++ b/content/browser/device_sensors/device_sensor_service.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/device_inertial_sensor_service.h"
+#include "content/browser/device_sensors/device_sensor_service.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -11,24 +11,21 @@
namespace content {
-DeviceInertialSensorService::DeviceInertialSensorService()
+DeviceSensorService::DeviceSensorService()
: num_light_readers_(0),
num_motion_readers_(0),
num_orientation_readers_(0),
num_orientation_absolute_readers_(0),
- is_shutdown_(false) {
-}
+ is_shutdown_(false) {}
-DeviceInertialSensorService::~DeviceInertialSensorService() {
-}
+DeviceSensorService::~DeviceSensorService() {}
-DeviceInertialSensorService* DeviceInertialSensorService::GetInstance() {
- return base::Singleton<
- DeviceInertialSensorService,
- base::LeakySingletonTraits<DeviceInertialSensorService>>::get();
+DeviceSensorService* DeviceSensorService::GetInstance() {
+ return base::Singleton<DeviceSensorService, base::LeakySingletonTraits<
+ DeviceSensorService>>::get();
}
-void DeviceInertialSensorService::AddConsumer(ConsumerType consumer_type) {
+void DeviceSensorService::AddConsumer(ConsumerType consumer_type) {
if (!ChangeNumberConsumers(consumer_type, 1))
return;
@@ -39,7 +36,7 @@ void DeviceInertialSensorService::AddConsumer(ConsumerType consumer_type) {
data_fetcher_->StartFetchingDeviceData(consumer_type);
}
-void DeviceInertialSensorService::RemoveConsumer(ConsumerType consumer_type) {
+void DeviceSensorService::RemoveConsumer(ConsumerType consumer_type) {
if (!ChangeNumberConsumers(consumer_type, -1))
return;
@@ -47,8 +44,8 @@ void DeviceInertialSensorService::RemoveConsumer(ConsumerType consumer_type) {
data_fetcher_->StopFetchingDeviceData(consumer_type);
}
-bool DeviceInertialSensorService::ChangeNumberConsumers(
- ConsumerType consumer_type, int delta) {
+bool DeviceSensorService::ChangeNumberConsumers(ConsumerType consumer_type,
+ int delta) {
DCHECK(thread_checker_.CalledOnValidThread());
if (is_shutdown_)
return false;
@@ -60,11 +57,11 @@ bool DeviceInertialSensorService::ChangeNumberConsumers(
return true;
case CONSUMER_TYPE_ORIENTATION:
num_orientation_readers_ += delta;
- DCHECK_GE(num_orientation_readers_ , 0);
+ DCHECK_GE(num_orientation_readers_, 0);
return true;
case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
num_orientation_absolute_readers_ += delta;
- DCHECK_GE(num_orientation_absolute_readers_ , 0);
+ DCHECK_GE(num_orientation_absolute_readers_, 0);
return true;
case CONSUMER_TYPE_LIGHT:
num_light_readers_ += delta;
@@ -76,8 +73,7 @@ bool DeviceInertialSensorService::ChangeNumberConsumers(
return false;
}
-int DeviceInertialSensorService::GetNumberConsumers(
- ConsumerType consumer_type) const {
+int DeviceSensorService::GetNumberConsumers(ConsumerType consumer_type) const {
switch (consumer_type) {
case CONSUMER_TYPE_MOTION:
return num_motion_readers_;
@@ -93,13 +89,13 @@ int DeviceInertialSensorService::GetNumberConsumers(
return 0;
}
-mojo::ScopedSharedBufferHandle
-DeviceInertialSensorService::GetSharedMemoryHandle(ConsumerType consumer_type) {
+mojo::ScopedSharedBufferHandle DeviceSensorService::GetSharedMemoryHandle(
+ ConsumerType consumer_type) {
DCHECK(thread_checker_.CalledOnValidThread());
return data_fetcher_->GetSharedMemoryHandle(consumer_type);
}
-void DeviceInertialSensorService::Shutdown() {
+void DeviceSensorService::Shutdown() {
if (data_fetcher_) {
data_fetcher_->Shutdown();
data_fetcher_.reset();
@@ -107,7 +103,7 @@ void DeviceInertialSensorService::Shutdown() {
is_shutdown_ = true;
}
-void DeviceInertialSensorService::SetDataFetcherForTesting(
+void DeviceSensorService::SetDataFetcherForTesting(
DataFetcherSharedMemory* test_data_fetcher) {
if (data_fetcher_)
data_fetcher_->Shutdown();
« no previous file with comments | « content/browser/device_sensors/device_sensor_service.h ('k') | content/browser/device_sensors/device_sensors_consts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698