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

Side by Side Diff: ppapi/thunk/ppb_video_decoder_thunk.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 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/thunk/ppb_video_decoder_api.h ('k') | ppapi/thunk/ppb_websocket_api.h » ('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/c/pp_errors.h" 5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/shared_impl/tracked_callback.h"
6 #include "ppapi/thunk/enter.h" 7 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/thunk.h" 8 #include "ppapi/thunk/thunk.h"
8 #include "ppapi/thunk/ppb_video_decoder_api.h" 9 #include "ppapi/thunk/ppb_video_decoder_api.h"
9 #include "ppapi/thunk/resource_creation_api.h" 10 #include "ppapi/thunk/resource_creation_api.h"
10 11
11 namespace ppapi { 12 namespace ppapi {
12 namespace thunk { 13 namespace thunk {
13 14
14 namespace { 15 namespace {
15 16
(...skipping 12 matching lines...) Expand all
28 EnterVideoDecoder enter(resource, false); 29 EnterVideoDecoder enter(resource, false);
29 return PP_FromBool(enter.succeeded()); 30 return PP_FromBool(enter.succeeded());
30 } 31 }
31 32
32 int32_t Decode(PP_Resource video_decoder, 33 int32_t Decode(PP_Resource video_decoder,
33 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 34 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
34 PP_CompletionCallback callback) { 35 PP_CompletionCallback callback) {
35 EnterVideoDecoder enter(video_decoder, callback, true); 36 EnterVideoDecoder enter(video_decoder, callback, true);
36 if (enter.failed()) 37 if (enter.failed())
37 return enter.retval(); 38 return enter.retval();
38 return enter.SetResult(enter.object()->Decode(bitstream_buffer, callback)); 39 return enter.SetResult(enter.object()->Decode(bitstream_buffer,
40 enter.callback()));
39 } 41 }
40 42
41 void AssignPictureBuffers(PP_Resource video_decoder, 43 void AssignPictureBuffers(PP_Resource video_decoder,
42 uint32_t no_of_buffers, 44 uint32_t no_of_buffers,
43 const PP_PictureBuffer_Dev* buffers) { 45 const PP_PictureBuffer_Dev* buffers) {
44 EnterVideoDecoder enter(video_decoder, true); 46 EnterVideoDecoder enter(video_decoder, true);
45 if (enter.succeeded()) 47 if (enter.succeeded())
46 enter.object()->AssignPictureBuffers(no_of_buffers, buffers); 48 enter.object()->AssignPictureBuffers(no_of_buffers, buffers);
47 } 49 }
48 50
49 void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) { 51 void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
50 EnterVideoDecoder enter(video_decoder, true); 52 EnterVideoDecoder enter(video_decoder, true);
51 if (enter.succeeded()) 53 if (enter.succeeded())
52 enter.object()->ReusePictureBuffer(picture_buffer_id); 54 enter.object()->ReusePictureBuffer(picture_buffer_id);
53 } 55 }
54 56
55 int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) { 57 int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
56 EnterVideoDecoder enter(video_decoder, callback, true); 58 EnterVideoDecoder enter(video_decoder, callback, true);
57 if (enter.failed()) 59 if (enter.failed())
58 return enter.retval(); 60 return enter.retval();
59 return enter.SetResult(enter.object()->Flush(callback)); 61 return enter.SetResult(enter.object()->Flush(enter.callback()));
60 } 62 }
61 63
62 int32_t Reset(PP_Resource video_decoder, 64 int32_t Reset(PP_Resource video_decoder,
63 PP_CompletionCallback callback) { 65 PP_CompletionCallback callback) {
64 EnterVideoDecoder enter(video_decoder, callback, true); 66 EnterVideoDecoder enter(video_decoder, callback, true);
65 if (enter.failed()) 67 if (enter.failed())
66 return enter.retval(); 68 return enter.retval();
67 return enter.SetResult(enter.object()->Reset(callback)); 69 return enter.SetResult(enter.object()->Reset(enter.callback()));
68 } 70 }
69 71
70 void Destroy(PP_Resource video_decoder) { 72 void Destroy(PP_Resource video_decoder) {
71 EnterVideoDecoder enter(video_decoder, true); 73 EnterVideoDecoder enter(video_decoder, true);
72 if (enter.succeeded()) 74 if (enter.succeeded())
73 enter.object()->Destroy(); 75 enter.object()->Destroy();
74 } 76 }
75 77
76 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = { 78 const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = {
77 &Create, 79 &Create,
78 &IsVideoDecoder, 80 &IsVideoDecoder,
79 &Decode, 81 &Decode,
80 &AssignPictureBuffers, 82 &AssignPictureBuffers,
81 &ReusePictureBuffer, 83 &ReusePictureBuffer,
82 &Flush, 84 &Flush,
83 &Reset, 85 &Reset,
84 &Destroy 86 &Destroy
85 }; 87 };
86 88
87 } // namespace 89 } // namespace
88 90
89 const PPB_VideoDecoder_Dev_0_16* GetPPB_VideoDecoder_Dev_0_16_Thunk() { 91 const PPB_VideoDecoder_Dev_0_16* GetPPB_VideoDecoder_Dev_0_16_Thunk() {
90 return &g_ppb_videodecoder_thunk; 92 return &g_ppb_videodecoder_thunk;
91 } 93 }
92 94
93 } // namespace thunk 95 } // namespace thunk
94 } // namespace ppapi 96 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_video_decoder_api.h ('k') | ppapi/thunk/ppb_websocket_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698