This source file includes following definitions.
- Start
- Stop
#include "content/browser/device_orientation/data_fetcher_shared_memory.h"
#include "base/logging.h"
#include "content/browser/device_orientation/sensor_manager_android.h"
#include "content/common/device_orientation/device_motion_hardware_buffer.h"
#include "content/common/device_orientation/device_orientation_hardware_buffer.h"
namespace content {
DataFetcherSharedMemory::DataFetcherSharedMemory() {
}
DataFetcherSharedMemory::~DataFetcherSharedMemory() {
}
bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
DCHECK(buffer);
switch (consumer_type) {
case CONSUMER_TYPE_MOTION:
return SensorManagerAndroid::GetInstance()->
StartFetchingDeviceMotionData(
static_cast<DeviceMotionHardwareBuffer*>(buffer));
case CONSUMER_TYPE_ORIENTATION:
return SensorManagerAndroid::GetInstance()->
StartFetchingDeviceOrientationData(
static_cast<DeviceOrientationHardwareBuffer*>(buffer));
default:
NOTREACHED();
}
return false;
}
bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
switch (consumer_type) {
case CONSUMER_TYPE_MOTION:
SensorManagerAndroid::GetInstance()->StopFetchingDeviceMotionData();
return true;
case CONSUMER_TYPE_ORIENTATION:
SensorManagerAndroid::GetInstance()->StopFetchingDeviceOrientationData();
return true;
default:
NOTREACHED();
}
return false;
}
}