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 #include "ppapi/proxy/ppb_buffer_proxy.h" | 5 #include "ppapi/proxy/ppb_buffer_proxy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 public: | 34 public: |
35 Buffer(const HostResource& resource, | 35 Buffer(const HostResource& resource, |
36 int memory_handle, | 36 int memory_handle, |
37 uint32_t size); | 37 uint32_t size); |
38 virtual ~Buffer(); | 38 virtual ~Buffer(); |
39 | 39 |
40 // Resource overrides. | 40 // Resource overrides. |
41 virtual Buffer* AsBuffer() OVERRIDE; | 41 virtual Buffer* AsBuffer() OVERRIDE; |
42 | 42 |
43 // ResourceObjectBase overries. | 43 // ResourceObjectBase overries. |
44 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; | 44 virtual ppapi::thunk::PPB_Buffer_API* AsBuffer_API() OVERRIDE; |
45 | 45 |
46 // PPB_Buffer_API implementation. | 46 // PPB_Buffer_API implementation. |
47 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; | 47 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; |
48 virtual PP_Bool IsMapped() OVERRIDE; | 48 virtual PP_Bool IsMapped() OVERRIDE; |
49 virtual void* Map() OVERRIDE; | 49 virtual void* Map() OVERRIDE; |
50 virtual void Unmap() OVERRIDE; | 50 virtual void Unmap() OVERRIDE; |
51 | 51 |
52 private: | 52 private: |
53 int memory_handle_; | 53 int memory_handle_; |
54 uint32_t size_; | 54 uint32_t size_; |
(...skipping 13 matching lines...) Expand all Loading... |
68 } | 68 } |
69 | 69 |
70 Buffer::~Buffer() { | 70 Buffer::~Buffer() { |
71 Unmap(); | 71 Unmap(); |
72 } | 72 } |
73 | 73 |
74 Buffer* Buffer::AsBuffer() { | 74 Buffer* Buffer::AsBuffer() { |
75 return this; | 75 return this; |
76 } | 76 } |
77 | 77 |
78 ppapi::thunk::PPB_Buffer_API* Buffer::AsPPB_Buffer_API() { | 78 ppapi::thunk::PPB_Buffer_API* Buffer::AsBuffer_API() { |
79 return this; | 79 return this; |
80 } | 80 } |
81 | 81 |
82 PP_Bool Buffer::Describe(uint32_t* size_in_bytes) { | 82 PP_Bool Buffer::Describe(uint32_t* size_in_bytes) { |
83 *size_in_bytes = size_; | 83 *size_in_bytes = size_; |
84 return PP_TRUE; | 84 return PP_TRUE; |
85 } | 85 } |
86 | 86 |
87 PP_Bool Buffer::IsMapped() { | 87 PP_Bool Buffer::IsMapped() { |
88 return PP_FromBool(!!mapped_data_); | 88 return PP_FromBool(!!mapped_data_); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 int* result_shm_handle) { | 153 int* result_shm_handle) { |
154 result_resource->SetHostResource( | 154 result_resource->SetHostResource( |
155 instance, | 155 instance, |
156 ppb_buffer_target()->Create(instance, size)); | 156 ppb_buffer_target()->Create(instance, size)); |
157 // TODO(brettw) set the shm handle from a trusted interface. | 157 // TODO(brettw) set the shm handle from a trusted interface. |
158 *result_shm_handle = 0; | 158 *result_shm_handle = 0; |
159 } | 159 } |
160 | 160 |
161 } // namespace proxy | 161 } // namespace proxy |
162 } // namespace pp | 162 } // namespace pp |
OLD | NEW |