summaryrefslogtreecommitdiffstats
path: root/content/browser/device_orientation
diff options
context:
space:
mode:
authortimvolodine@chromium.org <timvolodine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-17 02:30:00 +0000
committertimvolodine@chromium.org <timvolodine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-17 02:30:00 +0000
commit5da472a4df9400f4c951a1056fa032bcc3ebc843 (patch)
treebba2ed8705ebbb5f1c2616c61ff6c1881b157b5a /content/browser/device_orientation
parentd74eabc8b5c23107f67dfce28f3b18551bb77045 (diff)
downloadchromium_src-5da472a4df9400f4c951a1056fa032bcc3ebc843.zip
chromium_src-5da472a4df9400f4c951a1056fa032bcc3ebc843.tar.gz
chromium_src-5da472a4df9400f4c951a1056fa032bcc3ebc843.tar.bz2
Add default orientation data fetcher.
Add support for Device Orientation in the default data fetcher. The default data fetcher is only compiled for platforms where we don't have proper fetchers available, i.e. platforms other than Android, Windows or Mac. BUG=261165 Review URL: https://chromiumcodereview.appspot.com/23542018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/device_orientation')
-rw-r--r--content/browser/device_orientation/data_fetcher_shared_memory_default.cc23
1 files changed, 16 insertions, 7 deletions
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 45d2296..c05cdcd 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();
}