OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "content/renderer/pepper/pepper_video_decoder_host.h" | 5 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "content/common/gpu/client/gpu_channel_host.h" | 9 #include "content/common/gpu/client/gpu_channel_host.h" |
10 #include "content/common/pepper_file_util.h" | 10 #include "content/common/pepper_file_util.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 if (shm_id == shm_buffers_.size()) { | 189 if (shm_id == shm_buffers_.size()) { |
190 shm_buffers_.push_back(shm.release()); | 190 shm_buffers_.push_back(shm.release()); |
191 shm_buffer_busy_.push_back(false); | 191 shm_buffer_busy_.push_back(false); |
192 } else { | 192 } else { |
193 // Remove the old buffer. Delete manually since ScopedVector won't delete | 193 // Remove the old buffer. Delete manually since ScopedVector won't delete |
194 // the existing element if we just assign over it. | 194 // the existing element if we just assign over it. |
195 delete shm_buffers_[shm_id]; | 195 delete shm_buffers_[shm_id]; |
196 shm_buffers_[shm_id] = shm.release(); | 196 shm_buffers_[shm_id] = shm.release(); |
197 } | 197 } |
198 | 198 |
199 base::PlatformFile platform_file = | |
200 PlatformFileFromSharedMemoryHandle(shm_handle); | |
201 SerializedHandle handle( | 199 SerializedHandle handle( |
202 renderer_ppapi_host_->ShareHandleWithRemote(platform_file, false), | 200 renderer_ppapi_host_->ShareSharedMemoryHandleWithRemote(shm_handle), |
203 shm_size); | 201 shm_size); |
204 ppapi::host::ReplyMessageContext reply_context = | 202 ppapi::host::ReplyMessageContext reply_context = |
205 context->MakeReplyMessageContext(); | 203 context->MakeReplyMessageContext(); |
206 reply_context.params.AppendHandle(handle); | 204 reply_context.params.AppendHandle(handle); |
207 host()->SendReply(reply_context, | 205 host()->SendReply(reply_context, |
208 PpapiPluginMsg_VideoDecoder_GetShmReply(shm_size)); | 206 PpapiPluginMsg_VideoDecoder_GetShmReply(shm_size)); |
209 | 207 |
210 return PP_OK_COMPLETIONPENDING; | 208 return PP_OK_COMPLETIONPENDING; |
211 } | 209 } |
212 | 210 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 host()->SendUnsolicitedReply( | 425 host()->SendUnsolicitedReply( |
428 pp_resource(), | 426 pp_resource(), |
429 PpapiPluginMsg_VideoDecoder_RequestTextures( | 427 PpapiPluginMsg_VideoDecoder_RequestTextures( |
430 requested_num_of_buffers, | 428 requested_num_of_buffers, |
431 PP_MakeSize(dimensions.width(), dimensions.height()), | 429 PP_MakeSize(dimensions.width(), dimensions.height()), |
432 texture_target, | 430 texture_target, |
433 mailboxes)); | 431 mailboxes)); |
434 } | 432 } |
435 | 433 |
436 } // namespace content | 434 } // namespace content |
OLD | NEW |