Chromium Code Reviews| 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_video_decoder_proxy.h" | 5 #include "ppapi/proxy/ppb_video_decoder_proxy.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
| 10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 VideoDecoder* VideoDecoder::Create(const HostResource& resource, | 68 VideoDecoder* VideoDecoder::Create(const HostResource& resource, |
| 69 PP_Resource context3d_id, | 69 PP_Resource context3d_id, |
| 70 const PP_VideoConfigElement* config) { | 70 const PP_VideoConfigElement* config) { |
| 71 if (!context3d_id) | 71 if (!context3d_id) |
| 72 return NULL; | 72 return NULL; |
| 73 | 73 |
| 74 EnterResourceNoLock<PPB_Context3D_API> enter_context(context3d_id, true); | 74 EnterResourceNoLock<PPB_Context3D_API> enter_context(context3d_id, true); |
| 75 if (enter_context.failed()) | 75 if (enter_context.failed()) |
| 76 return NULL; | 76 return NULL; |
| 77 | 77 |
| 78 scoped_ptr<VideoDecoder> decoder(new VideoDecoder(resource)); | 78 scoped_ptr<VideoDecoder> decoder(new VideoDecoder(resource)); |
|
yzshen1
2011/08/10 17:26:51
[nit, optional]
you might want to use scoped_refpt
brettw
2011/08/10 17:40:28
Phew, good catch!
| |
| 79 if (decoder->Init(context3d_id, enter_context.object(), config)) | 79 if (decoder->Init(context3d_id, enter_context.object(), config)) |
| 80 return decoder.release(); | 80 return decoder.release(); |
| 81 return NULL; | 81 return NULL; |
| 82 } | 82 } |
| 83 | 83 |
| 84 VideoDecoder::~VideoDecoder() { | 84 VideoDecoder::~VideoDecoder() { |
| 85 } | 85 } |
| 86 | 86 |
| 87 ::ppapi::thunk::PPB_VideoDecoder_API* VideoDecoder::AsPPB_VideoDecoder_API() { | 87 ::ppapi::thunk::PPB_VideoDecoder_API* VideoDecoder::AsPPB_VideoDecoder_API() { |
| 88 return this; | 88 return this; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 static_cast<Context3D*>(enter_context.object()); | 246 static_cast<Context3D*>(enter_context.object()); |
| 247 HostResource host_context = ppb_context->host_resource(); | 247 HostResource host_context = ppb_context->host_resource(); |
| 248 | 248 |
| 249 HostResource result; | 249 HostResource result; |
| 250 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( | 250 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( |
| 251 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, instance, | 251 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, instance, |
| 252 host_context, copied, &result)); | 252 host_context, copied, &result)); |
| 253 if (result.is_null()) | 253 if (result.is_null()) |
| 254 return 0; | 254 return 0; |
| 255 | 255 |
| 256 linked_ptr<VideoDecoder> video_decoder( | 256 return PluginResourceTracker::GetInstance()->AddResource( |
| 257 VideoDecoder::Create(result, context3d_id, config)); | 257 VideoDecoder::Create(result, context3d_id, config)); |
| 258 | |
| 259 return PluginResourceTracker::GetInstance()->AddResource(video_decoder); | |
| 260 } | 258 } |
| 261 | 259 |
| 262 void PPB_VideoDecoder_Proxy::OnMsgCreate( | 260 void PPB_VideoDecoder_Proxy::OnMsgCreate( |
| 263 PP_Instance instance, const HostResource& context3d_id, | 261 PP_Instance instance, const HostResource& context3d_id, |
| 264 const std::vector<PP_VideoConfigElement>& config, | 262 const std::vector<PP_VideoConfigElement>& config, |
| 265 HostResource* result) { | 263 HostResource* result) { |
| 266 ::ppapi::thunk::EnterFunction< ::ppapi::thunk::ResourceCreationAPI> | 264 ::ppapi::thunk::EnterFunction< ::ppapi::thunk::ResourceCreationAPI> |
| 267 resource_creation(instance, true); | 265 resource_creation(instance, true); |
| 268 if (resource_creation.failed()) | 266 if (resource_creation.failed()) |
| 269 return; | 267 return; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 | 354 |
| 357 void PPB_VideoDecoder_Proxy::OnMsgResetACK( | 355 void PPB_VideoDecoder_Proxy::OnMsgResetACK( |
| 358 const HostResource& decoder, int32_t result) { | 356 const HostResource& decoder, int32_t result) { |
| 359 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); | 357 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); |
| 360 if (enter.succeeded()) | 358 if (enter.succeeded()) |
| 361 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); | 359 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); |
| 362 } | 360 } |
| 363 | 361 |
| 364 } // namespace proxy | 362 } // namespace proxy |
| 365 } // namespace pp | 363 } // namespace pp |
| OLD | NEW |