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

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

Issue 11359063: Refactor the way singleton-style resources are exposed via PPB_Instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 | « no previous file | ppapi/proxy/gamepad_resource.cc » ('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 #ifndef PPAPI_PROXY_GAMEPAD_RESOURCE_H_ 5 #ifndef PPAPI_PROXY_GAMEPAD_RESOURCE_H_
6 #define PPAPI_PROXY_GAMEPAD_RESOURCE_H_ 6 #define PPAPI_PROXY_GAMEPAD_RESOURCE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 17 matching lines...) Expand all
28 // perspective. But we need to make requests to the browser and get replies. 28 // perspective. But we need to make requests to the browser and get replies.
29 // It's more convenient to do this as a resource, so the instance just 29 // It's more convenient to do this as a resource, so the instance just
30 // maintains an internal lazily instantiated copy of this resource. 30 // maintains an internal lazily instantiated copy of this resource.
31 class PPAPI_PROXY_EXPORT GamepadResource 31 class PPAPI_PROXY_EXPORT GamepadResource
32 : public PluginResource, 32 : public PluginResource,
33 public thunk::PPB_Gamepad_API { 33 public thunk::PPB_Gamepad_API {
34 public: 34 public:
35 GamepadResource(Connection connection, PP_Instance instance); 35 GamepadResource(Connection connection, PP_Instance instance);
36 virtual ~GamepadResource(); 36 virtual ~GamepadResource();
37 37
38 // Resource implementation.
39 virtual thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE;
40
38 // PPB_Gamepad_API. 41 // PPB_Gamepad_API.
39 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE; 42 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE;
40 43
41 private: 44 private:
42 void OnPluginMsgSendMemory(const ResourceMessageReplyParams& params); 45 void OnPluginMsgSendMemory(const ResourceMessageReplyParams& params);
43 46
44 scoped_ptr<base::SharedMemory> shared_memory_; 47 scoped_ptr<base::SharedMemory> shared_memory_;
45 const ContentGamepadHardwareBuffer* buffer_; 48 const ContentGamepadHardwareBuffer* buffer_;
46 49
47 // Last data returned so we can use this in the event of a read failure. 50 // Last data returned so we can use this in the event of a read failure.
48 PP_GamepadsSampleData last_read_; 51 PP_GamepadsSampleData last_read_;
49 52
50 DISALLOW_COPY_AND_ASSIGN(GamepadResource); 53 DISALLOW_COPY_AND_ASSIGN(GamepadResource);
51 }; 54 };
52 55
53 } // namespace proxy 56 } // namespace proxy
54 } // namespace ppapi 57 } // namespace ppapi
55 58
56 #endif // PPAPI_PROXY_GAMEPAD_RESOURCE_H_ 59 #endif // PPAPI_PROXY_GAMEPAD_RESOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/gamepad_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698