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" | |
9 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 11 #include "ppapi/proxy/plugin_dispatcher.h" |
11 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
12 #include "ppapi/proxy/ppb_buffer_proxy.h" | 13 #include "ppapi/proxy/ppb_buffer_proxy.h" |
13 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" | 14 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
14 #include "ppapi/thunk/enter.h" | 15 #include "ppapi/thunk/enter.h" |
15 #include "ppapi/thunk/resource_creation_api.h" | 16 #include "ppapi/thunk/resource_creation_api.h" |
16 #include "ppapi/thunk/thunk.h" | 17 #include "ppapi/thunk/thunk.h" |
17 | 18 |
18 using ppapi::thunk::EnterResourceNoLock; | 19 using ppapi::thunk::EnterResourceNoLock; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 PP_VideoDecoder_Profile profile) { | 189 PP_VideoDecoder_Profile profile) { |
189 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 190 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
190 // Dispatcher is null if it cannot find the instance passed to it (i.e. if the | 191 // Dispatcher is null if it cannot find the instance passed to it (i.e. if the |
191 // client passes in an invalid instance). | 192 // client passes in an invalid instance). |
192 if (!dispatcher) | 193 if (!dispatcher) |
193 return 0; | 194 return 0; |
194 | 195 |
195 if (!dispatcher->preferences().is_accelerated_video_decode_enabled) | 196 if (!dispatcher->preferences().is_accelerated_video_decode_enabled) |
196 return 0; | 197 return 0; |
197 | 198 |
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)); | |
piman
2014/11/06 23:52:38
This works, but mostly my thinking was that PPB_Vi
| |
206 | |
198 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, | 207 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, |
199 true); | 208 true); |
200 if (enter_context.failed()) | 209 if (enter_context.failed()) |
201 return 0; | 210 return 0; |
202 | 211 |
203 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); | 212 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); |
204 | 213 |
205 HostResource result; | 214 HostResource result; |
206 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( | 215 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( |
207 API_ID_PPB_VIDEO_DECODER_DEV, instance, | 216 API_ID_PPB_VIDEO_DECODER_DEV, instance, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 | 323 |
315 void PPB_VideoDecoder_Proxy::OnMsgResetACK( | 324 void PPB_VideoDecoder_Proxy::OnMsgResetACK( |
316 const HostResource& decoder, int32_t result) { | 325 const HostResource& decoder, int32_t result) { |
317 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder); | 326 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder); |
318 if (enter.succeeded()) | 327 if (enter.succeeded()) |
319 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); | 328 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); |
320 } | 329 } |
321 | 330 |
322 } // namespace proxy | 331 } // namespace proxy |
323 } // namespace ppapi | 332 } // namespace ppapi |
OLD | NEW |