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/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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( | 185 PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( |
186 PP_Instance instance, | 186 PP_Instance instance, |
187 PP_Resource graphics_context, | 187 PP_Resource graphics_context, |
188 PP_VideoDecoder_Profile profile) { | 188 PP_VideoDecoder_Profile profile) { |
189 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 189 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
190 // 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 |
191 // client passes in an invalid instance). | 191 // client passes in an invalid instance). |
192 if (!dispatcher) | 192 if (!dispatcher) |
193 return 0; | 193 return 0; |
194 | 194 |
| 195 if (!dispatcher->preferences().is_accelerated_video_decode_enabled) |
| 196 return 0; |
| 197 |
195 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, | 198 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, |
196 true); | 199 true); |
197 if (enter_context.failed()) | 200 if (enter_context.failed()) |
198 return 0; | 201 return 0; |
199 | 202 |
200 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); | 203 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); |
201 | 204 |
202 HostResource result; | 205 HostResource result; |
203 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( | 206 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( |
204 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... |
311 | 314 |
312 void PPB_VideoDecoder_Proxy::OnMsgResetACK( | 315 void PPB_VideoDecoder_Proxy::OnMsgResetACK( |
313 const HostResource& decoder, int32_t result) { | 316 const HostResource& decoder, int32_t result) { |
314 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); | 317 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); |
315 if (enter.succeeded()) | 318 if (enter.succeeded()) |
316 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); | 319 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); |
317 } | 320 } |
318 | 321 |
319 } // namespace proxy | 322 } // namespace proxy |
320 } // namespace ppapi | 323 } // namespace ppapi |
OLD | NEW |