Chromium Code Reviews| Index: content/browser/device_orientation/data_fetcher_platform.cc |
| diff --git a/content/browser/device_orientation/data_fetcher_platform.cc b/content/browser/device_orientation/data_fetcher_platform.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f6a38cad3aed29cb19fab809beb997e32e6fb6b7 |
| --- /dev/null |
| +++ b/content/browser/device_orientation/data_fetcher_platform.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/logging.h" |
| +#include "data_fetcher_platform.h" |
| + |
| +namespace content { |
| + |
| +SharedMemoryPlatformDataFetcherEmpty::SharedMemoryPlatformDataFetcherEmpty() |
| + : device_motion_buffer_(0) { |
|
bulach
2013/07/04 08:23:36
nit: NULL
timvolodine
2013/07/04 12:02:52
Done.
|
| +} |
| + |
| +SharedMemoryPlatformDataFetcherEmpty* |
| +SharedMemoryPlatformDataFetcherEmpty::instance() { |
| + CR_DEFINE_STATIC_LOCAL(SharedMemoryPlatformDataFetcherEmpty, |
| + s_data_fetcher, ()); |
| + return &s_data_fetcher; |
| +} |
| + |
| +bool SharedMemoryPlatformDataFetcherEmpty::NeedsPolling() { |
| + return false; |
| +} |
| + |
| +bool SharedMemoryPlatformDataFetcherEmpty::FetchDeviceMotionDataIntoBuffer() { |
| + DCHECK(NeedsPolling()); |
| + return false; |
| +} |
| + |
| +bool SharedMemoryPlatformDataFetcherEmpty::StartFetchingDeviceMotionData( |
| + DeviceMotionHardwareBuffer* buffer) { |
| + DCHECK(buffer); |
| + device_motion_buffer_->seqlock.WriteBegin(); |
| + device_motion_buffer_->data.allAvailableSensorsAreActive = true; |
| + device_motion_buffer_->seqlock.WriteEnd(); |
| + return true; |
| +} |
| + |
| +void SharedMemoryPlatformDataFetcherEmpty::StopFetchingDeviceMotionData() { |
| + device_motion_buffer_->seqlock.WriteBegin(); |
| + device_motion_buffer_->data.allAvailableSensorsAreActive = false; |
| + device_motion_buffer_->seqlock.WriteEnd(); |
| +} |
| + |
| +} // namespace content |