OLD | NEW |
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_PROXY_PPB_BUFFER_PROXY_H_ |
6 #define PPAPI_PPB_BUFFER_PROXY_H_ | 6 #define PPAPI_PROXY_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/shared_impl/resource.h" | 11 #include "ppapi/shared_impl/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; | |
15 | |
16 namespace ppapi { | 14 namespace ppapi { |
17 | 15 |
18 class HostResource; | 16 class HostResource; |
19 | 17 |
20 namespace proxy { | 18 namespace proxy { |
21 | 19 |
22 class Buffer : public thunk::PPB_Buffer_API, public Resource { | 20 class Buffer : public thunk::PPB_Buffer_API, public Resource { |
23 public: | 21 public: |
24 Buffer(const HostResource& resource, | 22 Buffer(const HostResource& resource, |
25 const base::SharedMemoryHandle& shm_handle, | 23 const base::SharedMemoryHandle& shm_handle, |
(...skipping 13 matching lines...) Expand all Loading... |
39 base::SharedMemory shm_; | 37 base::SharedMemory shm_; |
40 uint32_t size_; | 38 uint32_t size_; |
41 void* mapped_data_; | 39 void* mapped_data_; |
42 int map_count_; | 40 int map_count_; |
43 | 41 |
44 DISALLOW_COPY_AND_ASSIGN(Buffer); | 42 DISALLOW_COPY_AND_ASSIGN(Buffer); |
45 }; | 43 }; |
46 | 44 |
47 class PPB_Buffer_Proxy : public InterfaceProxy { | 45 class PPB_Buffer_Proxy : public InterfaceProxy { |
48 public: | 46 public: |
49 PPB_Buffer_Proxy(Dispatcher* dispatcher); | 47 explicit PPB_Buffer_Proxy(Dispatcher* dispatcher); |
50 virtual ~PPB_Buffer_Proxy(); | 48 virtual ~PPB_Buffer_Proxy(); |
51 | 49 |
52 static PP_Resource CreateProxyResource(PP_Instance instance, | 50 static PP_Resource CreateProxyResource(PP_Instance instance, |
53 uint32_t size); | 51 uint32_t size); |
54 static PP_Resource AddProxyResource(const HostResource& resource, | 52 static PP_Resource AddProxyResource(const HostResource& resource, |
55 base::SharedMemoryHandle shm_handle, | 53 base::SharedMemoryHandle shm_handle, |
56 uint32_t size); | 54 uint32_t size); |
57 | 55 |
58 // InterfaceProxy implementation. | 56 // InterfaceProxy implementation. |
59 virtual bool OnMessageReceived(const IPC::Message& msg); | 57 virtual bool OnMessageReceived(const IPC::Message& msg); |
60 | 58 |
61 static const ApiID kApiID = API_ID_PPB_BUFFER; | 59 static const ApiID kApiID = API_ID_PPB_BUFFER; |
62 | 60 |
63 private: | 61 private: |
64 // Message handlers. | 62 // Message handlers. |
65 void OnMsgCreate(PP_Instance instance, | 63 void OnMsgCreate(PP_Instance instance, |
66 uint32_t size, | 64 uint32_t size, |
67 HostResource* result_resource, | 65 HostResource* result_resource, |
68 base::SharedMemoryHandle* result_shm_handle); | 66 base::SharedMemoryHandle* result_shm_handle); |
69 }; | 67 }; |
70 | 68 |
71 } // namespace proxy | 69 } // namespace proxy |
72 } // namespace ppapi | 70 } // namespace ppapi |
73 | 71 |
74 #endif // PPAPI_PPB_BUFFER_PROXY_H_ | 72 #endif // PPAPI_PROXY_PPB_BUFFER_PROXY_H_ |
OLD | NEW |