OLD | NEW |
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 #include "ppapi/proxy/video_decoder_resource.h" | 5 #include "ppapi/proxy/video_decoder_resource.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 10 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ppapi/thunk/enter.h" | 25 #include "ppapi/thunk/enter.h" |
26 | 26 |
27 using ppapi::thunk::EnterResourceNoLock; | 27 using ppapi::thunk::EnterResourceNoLock; |
28 using ppapi::thunk::PPB_Graphics3D_API; | 28 using ppapi::thunk::PPB_Graphics3D_API; |
29 using ppapi::thunk::PPB_VideoDecoder_API; | 29 using ppapi::thunk::PPB_VideoDecoder_API; |
30 | 30 |
31 namespace ppapi { | 31 namespace ppapi { |
32 namespace proxy { | 32 namespace proxy { |
33 | 33 |
34 VideoDecoderResource::ShmBuffer::ShmBuffer( | 34 VideoDecoderResource::ShmBuffer::ShmBuffer( |
35 scoped_ptr<base::SharedMemory> shm_ptr, | 35 std::unique_ptr<base::SharedMemory> shm_ptr, |
36 uint32_t size, | 36 uint32_t size, |
37 uint32_t shm_id) | 37 uint32_t shm_id) |
38 : shm(std::move(shm_ptr)), addr(NULL), shm_id(shm_id) { | 38 : shm(std::move(shm_ptr)), addr(NULL), shm_id(shm_id) { |
39 if (shm->Map(size)) | 39 if (shm->Map(size)) |
40 addr = shm->memory(); | 40 addr = shm->memory(); |
41 } | 41 } |
42 | 42 |
43 VideoDecoderResource::ShmBuffer::~ShmBuffer() { | 43 VideoDecoderResource::ShmBuffer::~ShmBuffer() { |
44 } | 44 } |
45 | 45 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 &reply, | 223 &reply, |
224 &reply_params); | 224 &reply_params); |
225 if (result != PP_OK) | 225 if (result != PP_OK) |
226 return PP_ERROR_FAILED; | 226 return PP_ERROR_FAILED; |
227 if (!UnpackMessage<PpapiPluginMsg_VideoDecoder_GetShmReply>(reply, | 227 if (!UnpackMessage<PpapiPluginMsg_VideoDecoder_GetShmReply>(reply, |
228 &shm_size)) | 228 &shm_size)) |
229 return PP_ERROR_FAILED; | 229 return PP_ERROR_FAILED; |
230 base::SharedMemoryHandle shm_handle = base::SharedMemory::NULLHandle(); | 230 base::SharedMemoryHandle shm_handle = base::SharedMemory::NULLHandle(); |
231 if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &shm_handle)) | 231 if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &shm_handle)) |
232 return PP_ERROR_NOMEMORY; | 232 return PP_ERROR_NOMEMORY; |
233 scoped_ptr<base::SharedMemory> shm( | 233 std::unique_ptr<base::SharedMemory> shm( |
234 new base::SharedMemory(shm_handle, false /* read_only */)); | 234 new base::SharedMemory(shm_handle, false /* read_only */)); |
235 scoped_ptr<ShmBuffer> shm_buffer( | 235 std::unique_ptr<ShmBuffer> shm_buffer( |
236 new ShmBuffer(std::move(shm), shm_size, shm_id)); | 236 new ShmBuffer(std::move(shm), shm_size, shm_id)); |
237 if (!shm_buffer->addr) | 237 if (!shm_buffer->addr) |
238 return PP_ERROR_NOMEMORY; | 238 return PP_ERROR_NOMEMORY; |
239 | 239 |
240 available_shm_buffers_.push_back(shm_buffer.get()); | 240 available_shm_buffers_.push_back(shm_buffer.get()); |
241 if (shm_buffers_.size() < kMaximumPendingDecodes) { | 241 if (shm_buffers_.size() < kMaximumPendingDecodes) { |
242 shm_buffers_.push_back(shm_buffer.release()); | 242 shm_buffers_.push_back(shm_buffer.release()); |
243 } else { | 243 } else { |
244 // Delete manually since ScopedVector won't delete the existing element if | 244 // Delete manually since ScopedVector won't delete the existing element if |
245 // we just assign it. | 245 // we just assign it. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 get_picture_0_1_->texture_target = texture_target; | 576 get_picture_0_1_->texture_target = texture_target; |
577 get_picture_0_1_->texture_size = texture_size; | 577 get_picture_0_1_->texture_size = texture_size; |
578 get_picture_0_1_ = NULL; | 578 get_picture_0_1_ = NULL; |
579 } | 579 } |
580 | 580 |
581 received_pictures_.pop(); | 581 received_pictures_.pop(); |
582 } | 582 } |
583 | 583 |
584 } // namespace proxy | 584 } // namespace proxy |
585 } // namespace ppapi | 585 } // namespace ppapi |
OLD | NEW |