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

Unified Diff: content/browser/device_orientation/device_inertial_sensor_service.cc

Issue 152893002: [DeviceLight API] Content Side Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix in Java file, stop() Created 6 years, 9 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_orientation/device_inertial_sensor_service.cc
diff --git a/content/browser/device_orientation/device_inertial_sensor_service.cc b/content/browser/device_orientation/device_inertial_sensor_service.cc
index cb8bbf300b29226ec269a152f31ad80239dc143b..20608203c40a9650a8693a990cbed858abf3a94c 100644
--- a/content/browser/device_orientation/device_inertial_sensor_service.cc
+++ b/content/browser/device_orientation/device_inertial_sensor_service.cc
@@ -13,7 +13,8 @@
namespace content {
DeviceInertialSensorService::DeviceInertialSensorService()
- : num_motion_readers_(0),
+ : num_light_readers_(0),
+ num_motion_readers_(0),
num_orientation_readers_(0),
is_shutdown_(false) {
}
@@ -52,13 +53,17 @@ bool DeviceInertialSensorService::ChangeNumberConsumers(
return false;
switch (consumer_type) {
+ case CONSUMER_TYPE_LIGHT:
+ num_light_readers_ += delta;
+ DCHECK_GE(num_light_readers_ , 0);
+ return true;
case CONSUMER_TYPE_MOTION:
num_motion_readers_ += delta;
- DCHECK(num_motion_readers_ >= 0);
+ DCHECK_GE(num_motion_readers_ , 0);
return true;
case CONSUMER_TYPE_ORIENTATION:
num_orientation_readers_ += delta;
- DCHECK(num_orientation_readers_ >= 0);
+ DCHECK_GE(num_orientation_readers_ , 0);
return true;
default:
NOTREACHED();
@@ -69,6 +74,8 @@ bool DeviceInertialSensorService::ChangeNumberConsumers(
int DeviceInertialSensorService::GetNumberConsumers(
ConsumerType consumer_type) const {
switch (consumer_type) {
+ case CONSUMER_TYPE_LIGHT:
+ return num_light_readers_;
case CONSUMER_TYPE_MOTION:
return num_motion_readers_;
case CONSUMER_TYPE_ORIENTATION:

Powered by Google App Engine
This is Rietveld 408576698