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

Unified Diff: device/sensors/data_fetcher_shared_memory_mac.cc

Issue 2845763002: Remove DeviceLightEvent implementation (Closed)
Patch Set: same as previous patch 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
Index: device/sensors/data_fetcher_shared_memory_mac.cc
diff --git a/device/sensors/data_fetcher_shared_memory_mac.cc b/device/sensors/data_fetcher_shared_memory_mac.cc
index b06c850ca48b474355c117d2d0cc0eab7b9535d7..b3aa760c055463bfc93ce8e98077edf86eafb3f5 100644
--- a/device/sensors/data_fetcher_shared_memory_mac.cc
+++ b/device/sensors/data_fetcher_shared_memory_mac.cc
@@ -9,30 +9,12 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
-#include "device/sensors/ambient_light_mac.h"
-#include "device/sensors/public/cpp/device_util_mac.h"
#include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h"
namespace device {
const double kMeanGravity = 9.80665;
-void FetchLight(AmbientLightSensor* sensor, DeviceLightHardwareBuffer* buffer) {
- DCHECK(sensor);
- DCHECK(buffer);
- // Macbook pro has 2 lux values, left and right, we take the average.
- // The raw sensor values are converted to lux using LMUvalueToLux(raw_value)
- // similar to how it is done in Firefox.
- uint64_t lux_value[2];
- if (!sensor->ReadSensorValue(lux_value))
- return;
- uint64_t mean = (lux_value[0] + lux_value[1]) / 2;
- double lux = LMUvalueToLux(mean);
- buffer->seqlock.WriteBegin();
- buffer->data.value = lux;
- buffer->seqlock.WriteEnd();
-}
-
void FetchMotion(SuddenMotionSensor* sensor,
DeviceMotionHardwareBuffer* buffer) {
DCHECK(sensor);
@@ -117,15 +99,12 @@ DataFetcherSharedMemory::~DataFetcherSharedMemory() {}
void DataFetcherSharedMemory::Fetch(unsigned consumer_bitmask) {
DCHECK(GetPollingMessageLoop()->task_runner()->BelongsToCurrentThread());
DCHECK(consumer_bitmask & CONSUMER_TYPE_ORIENTATION ||
- consumer_bitmask & CONSUMER_TYPE_MOTION ||
- consumer_bitmask & CONSUMER_TYPE_LIGHT);
+ consumer_bitmask & CONSUMER_TYPE_MOTION);
if (consumer_bitmask & CONSUMER_TYPE_ORIENTATION)
FetchOrientation(sudden_motion_sensor_.get(), orientation_buffer_);
if (consumer_bitmask & CONSUMER_TYPE_MOTION)
FetchMotion(sudden_motion_sensor_.get(), motion_buffer_);
- if (consumer_bitmask & CONSUMER_TYPE_LIGHT)
- FetchLight(ambient_light_sensor_.get(), light_buffer_);
}
DataFetcherSharedMemory::FetcherType DataFetcherSharedMemory::GetType() const {
@@ -189,20 +168,6 @@ bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
orientation_absolute_buffer_->seqlock.WriteEnd();
return false;
}
- case CONSUMER_TYPE_LIGHT: {
- if (!ambient_light_sensor_)
- ambient_light_sensor_ = AmbientLightSensor::Create();
- bool ambient_light_sensor_available =
- ambient_light_sensor_.get() != nullptr;
-
- light_buffer_ = static_cast<DeviceLightHardwareBuffer*>(buffer);
- if (!ambient_light_sensor_available) {
- light_buffer_->seqlock.WriteBegin();
- light_buffer_->data.value = std::numeric_limits<double>::infinity();
- light_buffer_->seqlock.WriteEnd();
- }
- return ambient_light_sensor_available;
- }
default:
NOTREACHED();
}
@@ -238,14 +203,6 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
orientation_absolute_buffer_ = nullptr;
}
return true;
- case CONSUMER_TYPE_LIGHT:
- if (light_buffer_) {
- light_buffer_->seqlock.WriteBegin();
- light_buffer_->data.value = -1;
- light_buffer_->seqlock.WriteEnd();
- light_buffer_ = nullptr;
- }
- return true;
default:
NOTREACHED();
}
« no previous file with comments | « device/sensors/data_fetcher_shared_memory_default.cc ('k') | device/sensors/data_fetcher_shared_memory_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698