Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: content/browser/device_orientation/device_motion_provider.cc

Issue 14678012: Implement the content/renderer and content/browser part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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.
4
5 #include "base/logging.h"
6 #include "content/browser/device_orientation/device_motion_provider.h"
7 #include "content/common/device_motion_hardware_buffer.h"
8
9 namespace content {
10
11 DeviceMotionProvider::DeviceMotionProvider() {
12 size_t data_size = sizeof(DeviceMotionHardwareBuffer);
13 bool res = device_motion_shared_memory_.CreateAndMapAnonymous(data_size);
14 CHECK(res);
15 DeviceMotionHardwareBuffer* hwbuf = SharedMemoryAsHardwareBuffer();
16 memset(hwbuf, 0, sizeof(DeviceMotionHardwareBuffer));
17 }
18
19 DeviceMotionProvider::~DeviceMotionProvider() {
20 }
21
22 base::SharedMemoryHandle DeviceMotionProvider::GetSharedMemoryHandleForProcess(
23 base::ProcessHandle process) {
24 base::SharedMemoryHandle renderer_handle;
25 device_motion_shared_memory_.ShareToProcess(process, &renderer_handle);
26 return renderer_handle;
27 }
28
29 void DeviceMotionProvider::StartFetchingDeviceMotionData() {
30 NOTIMPLEMENTED();
31 }
32
33 void DeviceMotionProvider::StopFetchingDeviceMotionData() {
34 NOTIMPLEMENTED();
35 }
36
37 DeviceMotionHardwareBuffer* DeviceMotionProvider::
38 SharedMemoryAsHardwareBuffer() {
39 void* mem = device_motion_shared_memory_.memory();
40 CHECK(mem);
41 return static_cast<DeviceMotionHardwareBuffer*>(mem);
42 }
43
44 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698