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

Side by Side Diff: content/browser/gamepad/gamepad_shared_buffer_impl.cc

Issue 2466073002: Movw GamepadService out of content/browser/ and into device/ (Closed)
Patch Set: Fixed everything but one unittest Created 4 years, 1 month 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 2016 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 "content/browser/gamepad/gamepad_shared_buffer_impl.h"
6
7 #include "content/common/gamepad_hardware_buffer.h"
8
9 namespace content {
10
11 GamepadSharedBufferImpl::GamepadSharedBufferImpl() {
12 size_t data_size = sizeof(GamepadHardwareBuffer);
13 bool res = shared_memory_.CreateAndMapAnonymous(data_size);
14 CHECK(res);
15
16 void* mem = shared_memory_.memory();
17 DCHECK(mem);
18 new (mem) GamepadHardwareBuffer();
19 }
20
21 GamepadSharedBufferImpl::~GamepadSharedBufferImpl() {
22 }
23
24 base::SharedMemory* GamepadSharedBufferImpl::shared_memory() {
25 return &shared_memory_;
26 }
27
28 blink::WebGamepads* GamepadSharedBufferImpl::buffer() {
29 return &(hardware_buffer()->buffer);
30 }
31
32 GamepadHardwareBuffer* GamepadSharedBufferImpl::hardware_buffer() {
33 void* mem = shared_memory_.memory();
34 DCHECK(mem);
35 return static_cast<GamepadHardwareBuffer*>(mem);
36 }
37
38 void GamepadSharedBufferImpl::WriteBegin() {
39 hardware_buffer()->sequence.WriteBegin();
40 }
41
42 void GamepadSharedBufferImpl::WriteEnd() {
43 hardware_buffer()->sequence.WriteEnd();
44 }
45
46 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_shared_buffer_impl.h ('k') | content/browser/renderer_host/gamepad_browser_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698