Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: ppapi/proxy/ppb_video_decoder_proxy.cc

Issue 263893005: Rename some PPB_VideoDecoder_Dev implementation types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename resource creation API method CreateVideoDecoder (add Dev). Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_video_decoder_proxy.h ('k') | ppapi/proxy/ppp_video_decoder_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/proxy/ppb_buffer_proxy.h" 12 #include "ppapi/proxy/ppb_buffer_proxy.h"
13 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" 13 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
14 #include "ppapi/thunk/enter.h" 14 #include "ppapi/thunk/enter.h"
15 #include "ppapi/thunk/resource_creation_api.h" 15 #include "ppapi/thunk/resource_creation_api.h"
16 #include "ppapi/thunk/thunk.h" 16 #include "ppapi/thunk/thunk.h"
17 17
18 using ppapi::thunk::EnterResourceNoLock; 18 using ppapi::thunk::EnterResourceNoLock;
19 using ppapi::thunk::PPB_Buffer_API; 19 using ppapi::thunk::PPB_Buffer_API;
20 using ppapi::thunk::PPB_Graphics3D_API; 20 using ppapi::thunk::PPB_Graphics3D_API;
21 using ppapi::thunk::PPB_VideoDecoder_API; 21 using ppapi::thunk::PPB_VideoDecoder_Dev_API;
22 22
23 namespace ppapi { 23 namespace ppapi {
24 namespace proxy { 24 namespace proxy {
25 25
26 class VideoDecoder : public PPB_VideoDecoder_Shared { 26 class VideoDecoder : public PPB_VideoDecoder_Shared {
27 public: 27 public:
28 // You must call Init() before using this class. 28 // You must call Init() before using this class.
29 explicit VideoDecoder(const HostResource& resource); 29 explicit VideoDecoder(const HostResource& resource);
30 virtual ~VideoDecoder(); 30 virtual ~VideoDecoder();
31 31
32 static VideoDecoder* Create(const HostResource& resource, 32 static VideoDecoder* Create(const HostResource& resource,
33 PP_Resource graphics_context, 33 PP_Resource graphics_context,
34 PP_VideoDecoder_Profile profile); 34 PP_VideoDecoder_Profile profile);
35 35
36 // PPB_VideoDecoder_API implementation. 36 // PPB_VideoDecoder_Dev_API implementation.
37 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 37 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
38 scoped_refptr<TrackedCallback> callback) OVERRIDE; 38 scoped_refptr<TrackedCallback> callback) OVERRIDE;
39 virtual void AssignPictureBuffers( 39 virtual void AssignPictureBuffers(
40 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; 40 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE;
41 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; 41 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE;
42 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE; 42 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
43 virtual int32_t Reset(scoped_refptr<TrackedCallback> callback) OVERRIDE; 43 virtual int32_t Reset(scoped_refptr<TrackedCallback> callback) OVERRIDE;
44 virtual void Destroy() OVERRIDE; 44 virtual void Destroy() OVERRIDE;
45 45
46 private: 46 private:
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void PPB_VideoDecoder_Proxy::OnMsgCreate( 218 void PPB_VideoDecoder_Proxy::OnMsgCreate(
219 PP_Instance instance, const HostResource& graphics_context, 219 PP_Instance instance, const HostResource& graphics_context,
220 PP_VideoDecoder_Profile profile, 220 PP_VideoDecoder_Profile profile,
221 HostResource* result) { 221 HostResource* result) {
222 thunk::EnterResourceCreation resource_creation(instance); 222 thunk::EnterResourceCreation resource_creation(instance);
223 if (resource_creation.failed()) 223 if (resource_creation.failed())
224 return; 224 return;
225 225
226 // Make the resource and get the API pointer to its interface. 226 // Make the resource and get the API pointer to its interface.
227 result->SetHostResource( 227 result->SetHostResource(
228 instance, resource_creation.functions()->CreateVideoDecoder( 228 instance, resource_creation.functions()->CreateVideoDecoderDev(
229 instance, graphics_context.host_resource(), profile)); 229 instance, graphics_context.host_resource(), profile));
230 } 230 }
231 231
232 void PPB_VideoDecoder_Proxy::OnMsgDecode( 232 void PPB_VideoDecoder_Proxy::OnMsgDecode(
233 const HostResource& decoder, 233 const HostResource& decoder,
234 const HostResource& buffer, int32 id, uint32 size) { 234 const HostResource& buffer, int32 id, uint32 size) {
235 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter( 235 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_Dev_API> enter(
236 decoder, callback_factory_, 236 decoder, callback_factory_,
237 &PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id); 237 &PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id);
238 if (enter.failed()) 238 if (enter.failed())
239 return; 239 return;
240 PP_VideoBitstreamBuffer_Dev bitstream = { id, buffer.host_resource(), size }; 240 PP_VideoBitstreamBuffer_Dev bitstream = { id, buffer.host_resource(), size };
241 enter.SetResult(enter.object()->Decode(&bitstream, enter.callback())); 241 enter.SetResult(enter.object()->Decode(&bitstream, enter.callback()));
242 } 242 }
243 243
244 void PPB_VideoDecoder_Proxy::OnMsgAssignPictureBuffers( 244 void PPB_VideoDecoder_Proxy::OnMsgAssignPictureBuffers(
245 const HostResource& decoder, 245 const HostResource& decoder,
246 const std::vector<PP_PictureBuffer_Dev>& buffers) { 246 const std::vector<PP_PictureBuffer_Dev>& buffers) {
247 EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder); 247 EnterHostFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder);
248 if (enter.succeeded() && !buffers.empty()) { 248 if (enter.succeeded() && !buffers.empty()) {
249 const PP_PictureBuffer_Dev* buffer_array = &buffers.front(); 249 const PP_PictureBuffer_Dev* buffer_array = &buffers.front();
250 enter.object()->AssignPictureBuffers(buffers.size(), buffer_array); 250 enter.object()->AssignPictureBuffers(buffers.size(), buffer_array);
251 } 251 }
252 } 252 }
253 253
254 void PPB_VideoDecoder_Proxy::OnMsgReusePictureBuffer( 254 void PPB_VideoDecoder_Proxy::OnMsgReusePictureBuffer(
255 const HostResource& decoder, int32 picture_buffer_id) { 255 const HostResource& decoder, int32 picture_buffer_id) {
256 EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder); 256 EnterHostFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder);
257 if (enter.succeeded()) 257 if (enter.succeeded())
258 enter.object()->ReusePictureBuffer(picture_buffer_id); 258 enter.object()->ReusePictureBuffer(picture_buffer_id);
259 } 259 }
260 260
261 void PPB_VideoDecoder_Proxy::OnMsgFlush(const HostResource& decoder) { 261 void PPB_VideoDecoder_Proxy::OnMsgFlush(const HostResource& decoder) {
262 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter( 262 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_Dev_API> enter(
263 decoder, callback_factory_, 263 decoder, callback_factory_,
264 &PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin, decoder); 264 &PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin, decoder);
265 if (enter.succeeded()) 265 if (enter.succeeded())
266 enter.SetResult(enter.object()->Flush(enter.callback())); 266 enter.SetResult(enter.object()->Flush(enter.callback()));
267 } 267 }
268 268
269 void PPB_VideoDecoder_Proxy::OnMsgReset(const HostResource& decoder) { 269 void PPB_VideoDecoder_Proxy::OnMsgReset(const HostResource& decoder) {
270 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter( 270 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_Dev_API> enter(
271 decoder, callback_factory_, 271 decoder, callback_factory_,
272 &PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin, decoder); 272 &PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin, decoder);
273 if (enter.succeeded()) 273 if (enter.succeeded())
274 enter.SetResult(enter.object()->Reset(enter.callback())); 274 enter.SetResult(enter.object()->Reset(enter.callback()));
275 } 275 }
276 276
277 void PPB_VideoDecoder_Proxy::OnMsgDestroy(const HostResource& decoder) { 277 void PPB_VideoDecoder_Proxy::OnMsgDestroy(const HostResource& decoder) {
278 EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder); 278 EnterHostFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder);
279 if (enter.succeeded()) 279 if (enter.succeeded())
280 enter.object()->Destroy(); 280 enter.object()->Destroy();
281 } 281 }
282 282
283 void PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin( 283 void PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin(
284 int32_t result, const HostResource& decoder, int32 id) { 284 int32_t result, const HostResource& decoder, int32 id) {
285 dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_EndOfBitstreamACK( 285 dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_EndOfBitstreamACK(
286 API_ID_PPB_VIDEO_DECODER_DEV, decoder, id, result)); 286 API_ID_PPB_VIDEO_DECODER_DEV, decoder, id, result));
287 } 287 }
288 288
289 void PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin( 289 void PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin(
290 int32_t result, const HostResource& decoder) { 290 int32_t result, const HostResource& decoder) {
291 dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_FlushACK( 291 dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_FlushACK(
292 API_ID_PPB_VIDEO_DECODER_DEV, decoder, result)); 292 API_ID_PPB_VIDEO_DECODER_DEV, decoder, result));
293 } 293 }
294 294
295 void PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin( 295 void PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin(
296 int32_t result, const HostResource& decoder) { 296 int32_t result, const HostResource& decoder) {
297 dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_ResetACK( 297 dispatcher()->Send(new PpapiMsg_PPBVideoDecoder_ResetACK(
298 API_ID_PPB_VIDEO_DECODER_DEV, decoder, result)); 298 API_ID_PPB_VIDEO_DECODER_DEV, decoder, result));
299 } 299 }
300 300
301 void PPB_VideoDecoder_Proxy::OnMsgEndOfBitstreamACK( 301 void PPB_VideoDecoder_Proxy::OnMsgEndOfBitstreamACK(
302 const HostResource& decoder, int32_t id, int32_t result) { 302 const HostResource& decoder, int32_t id, int32_t result) {
303 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); 303 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder);
304 if (enter.succeeded()) 304 if (enter.succeeded())
305 static_cast<VideoDecoder*>(enter.object())->EndOfBitstreamACK(id, result); 305 static_cast<VideoDecoder*>(enter.object())->EndOfBitstreamACK(id, result);
306 } 306 }
307 307
308 void PPB_VideoDecoder_Proxy::OnMsgFlushACK( 308 void PPB_VideoDecoder_Proxy::OnMsgFlushACK(
309 const HostResource& decoder, int32_t result) { 309 const HostResource& decoder, int32_t result) {
310 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); 310 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder);
311 if (enter.succeeded()) 311 if (enter.succeeded())
312 static_cast<VideoDecoder*>(enter.object())->FlushACK(result); 312 static_cast<VideoDecoder*>(enter.object())->FlushACK(result);
313 } 313 }
314 314
315 void PPB_VideoDecoder_Proxy::OnMsgResetACK( 315 void PPB_VideoDecoder_Proxy::OnMsgResetACK(
316 const HostResource& decoder, int32_t result) { 316 const HostResource& decoder, int32_t result) {
317 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); 317 EnterPluginFromHostResource<PPB_VideoDecoder_Dev_API> enter(decoder);
318 if (enter.succeeded()) 318 if (enter.succeeded())
319 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); 319 static_cast<VideoDecoder*>(enter.object())->ResetACK(result);
320 } 320 }
321 321
322 } // namespace proxy 322 } // namespace proxy
323 } // namespace ppapi 323 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_video_decoder_proxy.h ('k') | ppapi/proxy/ppp_video_decoder_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698