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

Side by Side Diff: ppapi/proxy/gamepad_resource.cc

Issue 12568010: Cleanup: Make gamepad API consistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/gamepad_resource.h" 5 #include "ppapi/proxy/gamepad_resource.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 base::Bind(&GamepadResource::OnPluginMsgSendMemory, this)); 55 base::Bind(&GamepadResource::OnPluginMsgSendMemory, this));
56 } 56 }
57 57
58 GamepadResource::~GamepadResource() { 58 GamepadResource::~GamepadResource() {
59 } 59 }
60 60
61 thunk::PPB_Gamepad_API* GamepadResource::AsPPB_Gamepad_API() { 61 thunk::PPB_Gamepad_API* GamepadResource::AsPPB_Gamepad_API() {
62 return this; 62 return this;
63 } 63 }
64 64
65 void GamepadResource::Sample(PP_GamepadsSampleData* data) { 65 void GamepadResource::Sample(PP_Instance instance,
dmichael (off chromium) 2013/03/19 19:01:06 see other nit
teravest 2013/03/19 19:39:33 Done.
66 PP_GamepadsSampleData* data) {
66 if (!buffer_) { 67 if (!buffer_) {
67 // Browser hasn't sent back our shared memory, give the plugin gamepad 68 // Browser hasn't sent back our shared memory, give the plugin gamepad
68 // data corresponding to "not connected". 69 // data corresponding to "not connected".
69 memset(data, 0, sizeof(PP_GamepadsSampleData)); 70 memset(data, 0, sizeof(PP_GamepadsSampleData));
70 return; 71 return;
71 } 72 }
72 73
73 // ========== 74 // ==========
74 // DANGER 75 // DANGER
75 // ========== 76 // ==========
(...skipping 30 matching lines...) Expand all
106 params.TakeSharedMemoryHandleAtIndex(0, &handle); 107 params.TakeSharedMemoryHandleAtIndex(0, &handle);
107 108
108 shared_memory_.reset(new base::SharedMemory(handle, true)); 109 shared_memory_.reset(new base::SharedMemory(handle, true));
109 CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer))); 110 CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer)));
110 buffer_ = static_cast<const ContentGamepadHardwareBuffer*>( 111 buffer_ = static_cast<const ContentGamepadHardwareBuffer*>(
111 shared_memory_->memory()); 112 shared_memory_->memory());
112 } 113 }
113 114
114 } // namespace proxy 115 } // namespace proxy
115 } // namespace ppapi 116 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698