summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk/ppb_video_decoder_thunk.cc
diff options
context:
space:
mode:
authorpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-30 21:42:37 +0000
committerpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-30 21:42:37 +0000
commit917e86adc3f824f518c999dcba20bfd4cbf18a18 (patch)
tree52fe38f61527360231c17a905015066fb5d34bba /ppapi/thunk/ppb_video_decoder_thunk.cc
parent9ae7b9195f0e06b64664bba52e9cc0e8b3470f56 (diff)
downloadchromium_src-917e86adc3f824f518c999dcba20bfd4cbf18a18.zip
chromium_src-917e86adc3f824f518c999dcba20bfd4cbf18a18.tar.gz
chromium_src-917e86adc3f824f518c999dcba20bfd4cbf18a18.tar.bz2
Add a flag field to PP_CompletionCallback to control if the callback should
always be invoked asynchronously on success or error or skipped if the operation can complete synchronously without blocking. Keep the default behavior as-is until clients update their code. Bump revisions of all interfaces that take callbacks as args. Update browser interface function implementations and C++ layer to force callbacks if sync option is not set. Change ppapi/tests to run tests involving callbacks with both flag options. BUG=79376 TEST=ppapi_tests + bots Review URL: http://codereview.chromium.org/6899055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_video_decoder_thunk.cc')
-rw-r--r--ppapi/thunk/ppb_video_decoder_thunk.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc
index f12a5b3..9d82113 100644
--- a/ppapi/thunk/ppb_video_decoder_thunk.cc
+++ b/ppapi/thunk/ppb_video_decoder_thunk.cc
@@ -3,8 +3,9 @@
// found in the LICENSE file.
#include "ppapi/c/pp_errors.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/common.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_video_decoder_api.h"
#include "ppapi/thunk/resource_creation_api.h"
@@ -46,8 +47,10 @@ int32_t Initialize(PP_Resource video_decoder,
PP_CompletionCallback callback) {
EnterVideoDecoder enter(video_decoder, true);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->Initialize(context_id, decoder_config, callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result =
+ enter.object()->Initialize(context_id, decoder_config, callback);
+ return MayForceCallback(callback, result);
}
int32_t Decode(PP_Resource video_decoder,
@@ -55,8 +58,9 @@ int32_t Decode(PP_Resource video_decoder,
PP_CompletionCallback callback) {
EnterVideoDecoder enter(video_decoder, true);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->Decode(bitstream_buffer, callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result = enter.object()->Decode(bitstream_buffer, callback);
+ return MayForceCallback(callback, result);
}
void AssignGLESBuffers(PP_Resource video_decoder,
@@ -84,16 +88,18 @@ void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
EnterVideoDecoder enter(video_decoder, true);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->Flush(callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result = enter.object()->Flush(callback);
+ return MayForceCallback(callback, result);
}
int32_t Abort(PP_Resource video_decoder,
PP_CompletionCallback callback) {
EnterVideoDecoder enter(video_decoder, true);
if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- return enter.object()->Abort(callback);
+ return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ int32_t result = enter.object()->Abort(callback);
+ return MayForceCallback(callback, result);
}
const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = {