IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / browser / device_orientation / data_fetcher_shared_memory_android.cc
blob194c0c21b8d195c673f71fb8e21bca9da4006fe2
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/device_orientation/data_fetcher_shared_memory.h"
7 #include "base/logging.h"
8 #include "content/browser/device_orientation/data_fetcher_impl_android.h"
9 #include "content/common/device_orientation/device_motion_hardware_buffer.h"
10 #include "content/common/device_orientation/device_orientation_hardware_buffer.h"
12 namespace content {
14 DataFetcherSharedMemory::DataFetcherSharedMemory() {
17 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
20 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
21 DCHECK(buffer);
23 switch (consumer_type) {
24 case CONSUMER_TYPE_MOTION:
25 return DataFetcherImplAndroid::GetInstance()->
26 StartFetchingDeviceMotionData(
27 static_cast<DeviceMotionHardwareBuffer*>(buffer));
28 case CONSUMER_TYPE_ORIENTATION:
29 return DataFetcherImplAndroid::GetInstance()->
30 StartFetchingDeviceOrientationData(
31 static_cast<DeviceOrientationHardwareBuffer*>(buffer));
32 default:
33 NOTREACHED();
35 return false;
38 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
39 switch (consumer_type) {
40 case CONSUMER_TYPE_MOTION:
41 DataFetcherImplAndroid::GetInstance()->StopFetchingDeviceMotionData();
42 return true;
43 case CONSUMER_TYPE_ORIENTATION:
44 DataFetcherImplAndroid::GetInstance()->
45 StopFetchingDeviceOrientationData();
46 return true;
47 default:
48 NOTREACHED();
50 return false;
53 } // namespace content