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

Unified Diff: device/sensors/data_fetcher_shared_memory_default.cc

Issue 2819273006: Move //device/sensor impl to be part of the internal implemenation of the Device Service. (Closed)
Patch Set: Move //device/sensor impl to be part of the internal implemenation of the Device Service 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_default.cc
diff --git a/device/sensors/data_fetcher_shared_memory_default.cc b/device/sensors/data_fetcher_shared_memory_default.cc
deleted file mode 100644
index 31bbd7a19012bad4aa0b88dfd48063f82a878b3d..0000000000000000000000000000000000000000
--- a/device/sensors/data_fetcher_shared_memory_default.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/sensors/data_fetcher_shared_memory.h"
-
-#include "base/logging.h"
-#include "base/metrics/histogram_macros.h"
-
-namespace {
-
-bool SetMotionBuffer(device::DeviceMotionHardwareBuffer* buffer, bool enabled) {
- if (!buffer)
- return false;
- buffer->seqlock.WriteBegin();
- buffer->data.all_available_sensors_are_active = enabled;
- buffer->seqlock.WriteEnd();
- return true;
-}
-
-bool SetOrientationBuffer(device::DeviceOrientationHardwareBuffer* buffer,
- bool enabled) {
- if (!buffer)
- return false;
- buffer->seqlock.WriteBegin();
- buffer->data.all_available_sensors_are_active = enabled;
- buffer->seqlock.WriteEnd();
- return true;
-}
-
-bool SetLightBuffer(device::DeviceLightHardwareBuffer* buffer, double lux) {
- if (!buffer)
- return false;
- buffer->seqlock.WriteBegin();
- buffer->data.value = lux;
- buffer->seqlock.WriteEnd();
- return true;
-}
-
-} // namespace
-
-namespace device {
-
-DataFetcherSharedMemory::DataFetcherSharedMemory() {}
-
-DataFetcherSharedMemory::~DataFetcherSharedMemory() {}
-
-bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
- DCHECK(buffer);
-
- switch (consumer_type) {
- case CONSUMER_TYPE_MOTION:
- motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer);
- UMA_HISTOGRAM_BOOLEAN("InertialSensor.MotionDefaultAvailable", false);
- return SetMotionBuffer(motion_buffer_, true);
- case CONSUMER_TYPE_ORIENTATION:
- orientation_buffer_ =
- static_cast<DeviceOrientationHardwareBuffer*>(buffer);
- UMA_HISTOGRAM_BOOLEAN("InertialSensor.OrientationDefaultAvailable",
- false);
- return SetOrientationBuffer(orientation_buffer_, true);
- case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
- orientation_absolute_buffer_ =
- static_cast<DeviceOrientationHardwareBuffer*>(buffer);
- return SetOrientationBuffer(orientation_absolute_buffer_, true);
- case CONSUMER_TYPE_LIGHT:
- light_buffer_ = static_cast<DeviceLightHardwareBuffer*>(buffer);
- return SetLightBuffer(light_buffer_,
- std::numeric_limits<double>::infinity());
- default:
- NOTREACHED();
- }
- return false;
-}
-
-bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
- switch (consumer_type) {
- case CONSUMER_TYPE_MOTION:
- return SetMotionBuffer(motion_buffer_, false);
- case CONSUMER_TYPE_ORIENTATION:
- return SetOrientationBuffer(orientation_buffer_, false);
- case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
- return SetOrientationBuffer(orientation_absolute_buffer_, false);
- case CONSUMER_TYPE_LIGHT:
- return SetLightBuffer(light_buffer_, -1);
- default:
- NOTREACHED();
- }
- return false;
-}
-
-} // namespace device
« no previous file with comments | « device/sensors/data_fetcher_shared_memory_chromeos.cc ('k') | device/sensors/data_fetcher_shared_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698