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/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/c/dev/ppp_video_decoder_dev.h" | |
10 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
11 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
13 #include "ppapi/proxy/ppb_buffer_proxy.h" | 12 #include "ppapi/proxy/ppb_buffer_proxy.h" |
14 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" | 13 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
15 #include "ppapi/thunk/enter.h" | 14 #include "ppapi/thunk/enter.h" |
16 #include "ppapi/thunk/resource_creation_api.h" | 15 #include "ppapi/thunk/resource_creation_api.h" |
17 #include "ppapi/thunk/thunk.h" | 16 #include "ppapi/thunk/thunk.h" |
18 | 17 |
19 using ppapi::thunk::EnterResourceNoLock; | 18 using ppapi::thunk::EnterResourceNoLock; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 PP_VideoDecoder_Profile profile) { | 188 PP_VideoDecoder_Profile profile) { |
190 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 189 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
191 // Dispatcher is null if it cannot find the instance passed to it (i.e. if the | 190 // Dispatcher is null if it cannot find the instance passed to it (i.e. if the |
192 // client passes in an invalid instance). | 191 // client passes in an invalid instance). |
193 if (!dispatcher) | 192 if (!dispatcher) |
194 return 0; | 193 return 0; |
195 | 194 |
196 if (!dispatcher->preferences().is_accelerated_video_decode_enabled) | 195 if (!dispatcher->preferences().is_accelerated_video_decode_enabled) |
197 return 0; | 196 return 0; |
198 | 197 |
199 // We must get the plugin interface now, prior to doing Create synchronously. | |
200 // Otherwise, the browser will try to get the interface via a re-entrant | |
201 // sync message back to us, which would deadlock. | |
202 const std::string if_name = PPP_VIDEODECODER_DEV_INTERFACE_0_11; | |
203 if (!dispatcher->GetPluginInterface(if_name)) | |
204 return 0; | |
205 dispatcher->Send(new PpapiHostMsg_PluginSupportsInterface(if_name)); | |
206 | |
207 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, | 198 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, |
208 true); | 199 true); |
209 if (enter_context.failed()) | 200 if (enter_context.failed()) |
210 return 0; | 201 return 0; |
211 | 202 |
212 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); | 203 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); |
213 | 204 |
214 HostResource result; | 205 HostResource result; |
215 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( | 206 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( |
216 API_ID_PPB_VIDEO_DECODER_DEV, instance, | 207 API_ID_PPB_VIDEO_DECODER_DEV, instance, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 314 |
324 void PPB_VideoDecoder_Proxy::OnMsgResetACK( | 315 void PPB_VideoDecoder_Proxy::OnMsgResetACK( |
325 const HostResource& decoder, int32_t result) { | 316 const HostResource& decoder, int32_t result) { |
326 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder); | 317 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder); |
327 if (enter.succeeded()) | 318 if (enter.succeeded()) |
328 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); | 319 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); |
329 } | 320 } |
330 | 321 |
331 } // namespace proxy | 322 } // namespace proxy |
332 } // namespace ppapi | 323 } // namespace ppapi |
OLD | NEW |