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

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

Issue 23542018: Add default orientation data fetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unnecessary includes Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 45d2296c01eff65e417ac5fd93a30aeffa742152..c05cdcdbb8f555dce96c98ee9cde851df098d847 100644
--- a/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
+++ b/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
@@ -5,8 +5,6 @@
#include "data_fetcher_shared_memory.h"
#include "base/logging.h"
-#include "content/common/device_motion_hardware_buffer.h"
-#include "content/common/device_orientation/device_orientation_hardware_buffer.h"
namespace {
@@ -20,11 +18,22 @@ static bool SetMotionBuffer(content::DeviceMotionHardwareBuffer* buffer,
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() {
+DataFetcherSharedMemory::DataFetcherSharedMemory()
+ : motion_buffer_(NULL), orientation_buffer_(NULL) {
}
DataFetcherSharedMemory::~DataFetcherSharedMemory() {
@@ -38,8 +47,9 @@ bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer);
return SetMotionBuffer(motion_buffer_, true);
case CONSUMER_TYPE_ORIENTATION:
- NOTIMPLEMENTED();
- break;
+ orientation_buffer_ =
+ static_cast<DeviceOrientationHardwareBuffer*>(buffer);
+ return SetOrientationBuffer(orientation_buffer_, true);
default:
NOTREACHED();
}
@@ -52,8 +62,7 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
case CONSUMER_TYPE_MOTION:
return SetMotionBuffer(motion_buffer_, false);
case CONSUMER_TYPE_ORIENTATION:
- NOTIMPLEMENTED();
- break;
+ return SetOrientationBuffer(orientation_buffer_, false);
default:
NOTREACHED();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698