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

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

Issue 236833003: Rename device_orientation to device_sensors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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: content/browser/device_orientation/data_fetcher_shared_memory_default.cc
diff --git a/content/browser/device_orientation/data_fetcher_shared_memory_default.cc b/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
deleted file mode 100644
index ce7b5676e6686ad75d4f5cb4299aaca634a50767..0000000000000000000000000000000000000000
--- a/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2013 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 "data_fetcher_shared_memory.h"
-
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-
-namespace {
-
-static bool SetMotionBuffer(content::DeviceMotionHardwareBuffer* buffer,
- bool enabled) {
- if (!buffer)
- return false;
- buffer->seqlock.WriteBegin();
- buffer->data.allAvailableSensorsAreActive = enabled;
- buffer->seqlock.WriteEnd();
- return true;
-}
-
-static bool SetOrientationBuffer(
- content::DeviceOrientationHardwareBuffer* buffer, bool enabled) {
- if (!buffer)
- return false;
- buffer->seqlock.WriteBegin();
- buffer->data.allAvailableSensorsAreActive = enabled;
- buffer->seqlock.WriteEnd();
- return true;
-}
-
-}
-
-namespace content {
-
-DataFetcherSharedMemory::DataFetcherSharedMemory()
- : motion_buffer_(NULL), orientation_buffer_(NULL) {
-}
-
-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);
- 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);
- default:
- NOTREACHED();
- }
- return false;
-}
-
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698