| Index: content/browser/device_orientation/device_motion_provider.cc
|
| diff --git a/content/browser/device_orientation/device_motion_provider.cc b/content/browser/device_orientation/device_motion_provider.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2d460eb08cf6087f4a0242a10a1965491fc7197b
|
| --- /dev/null
|
| +++ b/content/browser/device_orientation/device_motion_provider.cc
|
| @@ -0,0 +1,44 @@
|
| +// 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 "content/browser/device_orientation/device_motion_provider.h"
|
| +#include "content/common/device_motion_hardware_buffer.h"
|
| +
|
| +namespace content {
|
| +
|
| +DeviceMotionProvider::DeviceMotionProvider() {
|
| + size_t data_size = sizeof(DeviceMotionHardwareBuffer);
|
| + bool res = device_motion_shared_memory_.CreateAndMapAnonymous(data_size);
|
| + CHECK(res);
|
| + DeviceMotionHardwareBuffer* hwbuf = SharedMemoryAsHardwareBuffer();
|
| + memset(hwbuf, 0, sizeof(DeviceMotionHardwareBuffer));
|
| +}
|
| +
|
| +DeviceMotionProvider::~DeviceMotionProvider() {
|
| +}
|
| +
|
| +base::SharedMemoryHandle DeviceMotionProvider::GetSharedMemoryHandleForProcess(
|
| + base::ProcessHandle process) {
|
| + base::SharedMemoryHandle renderer_handle;
|
| + device_motion_shared_memory_.ShareToProcess(process, &renderer_handle);
|
| + return renderer_handle;
|
| +}
|
| +
|
| +void DeviceMotionProvider::StartFetchingDeviceMotionData() {
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| +void DeviceMotionProvider::StopFetchingDeviceMotionData() {
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| +DeviceMotionHardwareBuffer* DeviceMotionProvider::
|
| + SharedMemoryAsHardwareBuffer() {
|
| + void* mem = device_motion_shared_memory_.memory();
|
| + CHECK(mem);
|
| + return static_cast<DeviceMotionHardwareBuffer*>(mem);
|
| +}
|
| +
|
| +} // namespace content
|
|
|