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

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

Issue 11106019: PluginResource: Avoid having two sets of similar methods for talking with browser and renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/flash_resource.cc ('k') | ppapi/proxy/plugin_resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
41 return base::subtle::Release_Load(sequence) != version; 41 return base::subtle::Release_Load(sequence) != version;
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 GamepadResource::GamepadResource(Connection connection, PP_Instance instance) 46 GamepadResource::GamepadResource(Connection connection, PP_Instance instance)
47 : PluginResource(connection, instance), 47 : PluginResource(connection, instance),
48 buffer_(NULL) { 48 buffer_(NULL) {
49 memset(&last_read_, 0, sizeof(last_read_)); 49 memset(&last_read_, 0, sizeof(last_read_));
50 50
51 SendCreateToBrowser(PpapiHostMsg_Gamepad_Create()); 51 SendCreate(BROWSER, PpapiHostMsg_Gamepad_Create());
52 CallBrowser<PpapiPluginMsg_Gamepad_SendMemory>( 52 Call<PpapiPluginMsg_Gamepad_SendMemory>(
53 BROWSER,
53 PpapiHostMsg_Gamepad_RequestMemory(), 54 PpapiHostMsg_Gamepad_RequestMemory(),
54 base::Bind(&GamepadResource::OnPluginMsgSendMemory, this)); 55 base::Bind(&GamepadResource::OnPluginMsgSendMemory, this));
55 } 56 }
56 57
57 GamepadResource::~GamepadResource() { 58 GamepadResource::~GamepadResource() {
58 } 59 }
59 60
60 void GamepadResource::Sample(PP_GamepadsSampleData* data) { 61 void GamepadResource::Sample(PP_GamepadsSampleData* data) {
61 if (!buffer_) { 62 if (!buffer_) {
62 // Browser hasn't sent back our shared memory, give the plugin gamepad 63 // Browser hasn't sent back our shared memory, give the plugin gamepad
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 params.GetSharedMemoryHandleAtIndex(0, &handle); 102 params.GetSharedMemoryHandleAtIndex(0, &handle);
102 103
103 shared_memory_.reset(new base::SharedMemory(handle, true)); 104 shared_memory_.reset(new base::SharedMemory(handle, true));
104 CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer))); 105 CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer)));
105 buffer_ = static_cast<const ContentGamepadHardwareBuffer*>( 106 buffer_ = static_cast<const ContentGamepadHardwareBuffer*>(
106 shared_memory_->memory()); 107 shared_memory_->memory());
107 } 108 }
108 109
109 } // namespace proxy 110 } // namespace proxy
110 } // namespace ppapi 111 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/flash_resource.cc ('k') | ppapi/proxy/plugin_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698