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_context_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_context_3d_proxy.h" |
6 | 6 |
7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 virtual ~PepperCommandBuffer(); | 170 virtual ~PepperCommandBuffer(); |
171 | 171 |
172 // CommandBuffer implementation: | 172 // CommandBuffer implementation: |
173 virtual bool Initialize(int32 size); | 173 virtual bool Initialize(int32 size); |
174 virtual gpu::Buffer GetRingBuffer(); | 174 virtual gpu::Buffer GetRingBuffer(); |
175 virtual State GetState(); | 175 virtual State GetState(); |
176 virtual void Flush(int32 put_offset); | 176 virtual void Flush(int32 put_offset); |
177 virtual State FlushSync(int32 put_offset); | 177 virtual State FlushSync(int32 put_offset); |
178 virtual void SetGetOffset(int32 get_offset); | 178 virtual void SetGetOffset(int32 get_offset); |
179 virtual int32 CreateTransferBuffer(size_t size); | 179 virtual int32 CreateTransferBuffer(size_t size); |
| 180 virtual int32 RegisterTransferBuffer( |
| 181 base::SharedMemory* shared_memory, |
| 182 size_t size); |
180 virtual void DestroyTransferBuffer(int32 id); | 183 virtual void DestroyTransferBuffer(int32 id); |
181 virtual gpu::Buffer GetTransferBuffer(int32 handle); | 184 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
182 virtual void SetToken(int32 token); | 185 virtual void SetToken(int32 token); |
183 virtual void SetParseError(gpu::error::Error error); | 186 virtual void SetParseError(gpu::error::Error error); |
184 | 187 |
185 private: | 188 private: |
186 bool Send(IPC::Message* msg); | 189 bool Send(IPC::Message* msg); |
187 | 190 |
188 int32 num_entries_; | 191 int32 num_entries_; |
189 scoped_ptr<base::SharedMemory> ring_buffer_; | 192 scoped_ptr<base::SharedMemory> ring_buffer_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 int32 id; | 296 int32 id; |
294 if (Send(new PpapiHostMsg_PPBContext3D_CreateTransferBuffer( | 297 if (Send(new PpapiHostMsg_PPBContext3D_CreateTransferBuffer( |
295 INTERFACE_ID_PPB_CONTEXT_3D, resource_, size, &id))) { | 298 INTERFACE_ID_PPB_CONTEXT_3D, resource_, size, &id))) { |
296 return id; | 299 return id; |
297 } | 300 } |
298 } | 301 } |
299 | 302 |
300 return -1; | 303 return -1; |
301 } | 304 } |
302 | 305 |
| 306 int32 PepperCommandBuffer::RegisterTransferBuffer( |
| 307 base::SharedMemory* shared_memory, |
| 308 size_t size) { |
| 309 // Not implemented in proxy. |
| 310 NOTREACHED(); |
| 311 return -1; |
| 312 } |
| 313 |
303 void PepperCommandBuffer::DestroyTransferBuffer(int32 id) { | 314 void PepperCommandBuffer::DestroyTransferBuffer(int32 id) { |
304 if (last_state_.error != gpu::error::kNoError) | 315 if (last_state_.error != gpu::error::kNoError) |
305 return; | 316 return; |
306 | 317 |
307 // Remove the transfer buffer from the client side4 cache. | 318 // Remove the transfer buffer from the client side4 cache. |
308 TransferBufferMap::iterator it = transfer_buffers_.find(id); | 319 TransferBufferMap::iterator it = transfer_buffers_.find(id); |
309 DCHECK(it != transfer_buffers_.end()); | 320 DCHECK(it != transfer_buffers_.end()); |
310 | 321 |
311 // Delete the shared memory object, closing the handle in this process. | 322 // Delete the shared memory object, closing the handle in this process. |
312 delete it->second.shared_memory; | 323 delete it->second.shared_memory; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 &shm_handle, | 595 &shm_handle, |
585 &shm_size)) { | 596 &shm_size)) { |
586 return; | 597 return; |
587 } | 598 } |
588 *transfer_buffer = SHMHandleFromInt(shm_handle); | 599 *transfer_buffer = SHMHandleFromInt(shm_handle); |
589 *size = shm_size; | 600 *size = shm_size; |
590 } | 601 } |
591 | 602 |
592 } // namespace proxy | 603 } // namespace proxy |
593 } // namespace pp | 604 } // namespace pp |
OLD | NEW |