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
parent d74eabc8
......@@ -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();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment