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

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

Issue 7623018: Move host resource from the proxy to the shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 9 years, 4 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/ppb_broker_proxy.cc ('k') | ppapi/proxy/ppb_buffer_proxy.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PPB_BUFFER_PROXY_H_ 5 #ifndef PPAPI_PPB_BUFFER_PROXY_H_
6 #define PPAPI_PPB_BUFFER_PROXY_H_ 6 #define PPAPI_PPB_BUFFER_PROXY_H_
7 7
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/proxy/interface_proxy.h" 10 #include "ppapi/proxy/interface_proxy.h"
11 #include "ppapi/proxy/plugin_resource.h" 11 #include "ppapi/proxy/plugin_resource.h"
12 #include "ppapi/thunk/ppb_buffer_api.h" 12 #include "ppapi/thunk/ppb_buffer_api.h"
13 13
14 struct PPB_Buffer_Dev; 14 struct PPB_Buffer_Dev;
15 15
16 namespace ppapi {
17 class HostResource;
18 }
19
16 namespace pp { 20 namespace pp {
17 namespace proxy { 21 namespace proxy {
18 22
19 class HostResource;
20
21 class Buffer : public ppapi::thunk::PPB_Buffer_API, 23 class Buffer : public ppapi::thunk::PPB_Buffer_API,
22 public PluginResource { 24 public PluginResource {
23 public: 25 public:
24 Buffer(const HostResource& resource, 26 Buffer(const ppapi::HostResource& resource,
25 const base::SharedMemoryHandle& shm_handle, 27 const base::SharedMemoryHandle& shm_handle,
26 uint32_t size); 28 uint32_t size);
27 virtual ~Buffer(); 29 virtual ~Buffer();
28 30
29 // Resource overrides.
30 virtual Buffer* AsBuffer() OVERRIDE;
31
32 // ResourceObjectBase overrides. 31 // ResourceObjectBase overrides.
33 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; 32 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE;
34 33
35 // PPB_Buffer_API implementation. 34 // PPB_Buffer_API implementation.
36 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; 35 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE;
37 virtual PP_Bool IsMapped() OVERRIDE; 36 virtual PP_Bool IsMapped() OVERRIDE;
38 virtual void* Map() OVERRIDE; 37 virtual void* Map() OVERRIDE;
39 virtual void Unmap() OVERRIDE; 38 virtual void Unmap() OVERRIDE;
40 39
41 private: 40 private:
42 base::SharedMemory shm_; 41 base::SharedMemory shm_;
43 uint32_t size_; 42 uint32_t size_;
44 void* mapped_data_; 43 void* mapped_data_;
45 int map_count_; 44 int map_count_;
46 45
47 DISALLOW_COPY_AND_ASSIGN(Buffer); 46 DISALLOW_COPY_AND_ASSIGN(Buffer);
48 }; 47 };
49 48
50 class PPB_Buffer_Proxy : public InterfaceProxy { 49 class PPB_Buffer_Proxy : public InterfaceProxy {
51 public: 50 public:
52 PPB_Buffer_Proxy(Dispatcher* dispatcher, const void* target_interface); 51 PPB_Buffer_Proxy(Dispatcher* dispatcher, const void* target_interface);
53 virtual ~PPB_Buffer_Proxy(); 52 virtual ~PPB_Buffer_Proxy();
54 53
55 static const Info* GetInfo(); 54 static const Info* GetInfo();
56 55
57 static PP_Resource CreateProxyResource(PP_Instance instance, 56 static PP_Resource CreateProxyResource(PP_Instance instance,
58 uint32_t size); 57 uint32_t size);
59 static PP_Resource AddProxyResource(const HostResource& resource, 58 static PP_Resource AddProxyResource(const ppapi::HostResource& resource,
60 base::SharedMemoryHandle shm_handle, 59 base::SharedMemoryHandle shm_handle,
61 uint32_t size); 60 uint32_t size);
62 61
63 const PPB_Buffer_Dev* ppb_buffer_target() const { 62 const PPB_Buffer_Dev* ppb_buffer_target() const {
64 return static_cast<const PPB_Buffer_Dev*>(target_interface()); 63 return static_cast<const PPB_Buffer_Dev*>(target_interface());
65 } 64 }
66 65
67 // InterfaceProxy implementation. 66 // InterfaceProxy implementation.
68 virtual bool OnMessageReceived(const IPC::Message& msg); 67 virtual bool OnMessageReceived(const IPC::Message& msg);
69 68
70 private: 69 private:
71 // Message handlers. 70 // Message handlers.
72 void OnMsgCreate(PP_Instance instance, 71 void OnMsgCreate(PP_Instance instance,
73 uint32_t size, 72 uint32_t size,
74 HostResource* result_resource, 73 ppapi::HostResource* result_resource,
75 base::SharedMemoryHandle* result_shm_handle); 74 base::SharedMemoryHandle* result_shm_handle);
76 }; 75 };
77 76
78 } // namespace proxy 77 } // namespace proxy
79 } // namespace pp 78 } // namespace pp
80 79
81 #endif // PPAPI_PPB_BUFFER_PROXY_H_ 80 #endif // PPAPI_PPB_BUFFER_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_broker_proxy.cc ('k') | ppapi/proxy/ppb_buffer_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698