5 #ifndef PPAPI_CPP_COMPLETION_CALLBACK_H_
6 #define PPAPI_CPP_COMPLETION_CALLBACK_H_
8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/cpp/extensions/ext_output_traits.h"
11 #include "ppapi/cpp/logging.h"
12 #include "ppapi/cpp/module.h"
13 #include "ppapi/cpp/output_traits.h"
35 cc_ = PP_BlockUntilComplete();
45 cc_ = PP_MakeCompletionCallback(func, user_data);
60 cc_ = PP_MakeCompletionCallback(func, user_data);
85 PP_RunCompletionCallback(&
cc_, result);
98 PP_RunAndClearCompletionCallback(&
cc_, result);
115 return (
cc_.func == NULL ||
116 (
cc_.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL) != 0);
160 if (result == PP_OK_COMPLETIONPENDING ||
IsOptional())
164 return PP_OK_COMPLETIONPENDING;
168 PP_CompletionCallback
cc_;
178 template <
typename T,
typename Traits>
206 return Traits::StorageToAPIArg(*output_);
231 template <
typename T>
234 T, internal::CallbackOutputTraits<T> > {
256 typename BaseType::OutputStorageType*
output)
271 typename BaseType::OutputStorageType* output)
272 : BaseType(func, user_data, output) {
293 typename BaseType::OutputStorageType* output)
294 : BaseType(func, user_data, flags, output) {
303 template <
typename T>
306 T, internal::ExtCallbackOutputTraits<T> > {
308 typedef ::pp::internal::CompletionCallbackWithOutputBase<
341 :
BaseType(func, user_data, output) {
363 :
BaseType(func, user_data, flags, output) {
383 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_
Traits::APIArgType APIArgType
void RunAndClear(int32_t result)
::pp::internal::CompletionCallbackWithOutputBase< T, internal::ExtCallbackOutputTraits< T > > BaseType
ExtCompletionCallbackWithOutput(typename BaseType::OutputStorageType *output)
int32_t MayForce(int32_t result) const
CompletionCallbackWithOutputBase(OutputStorageType *output)
const PP_CompletionCallback & pp_completion_callback() const
ExtCompletionCallbackWithOutput(PP_CompletionCallback_Func func, void *user_data, int32_t flags, typename BaseType::OutputStorageType *output)
ExtCompletionCallbackWithOutput(PP_CompletionCallback_Func func, void *user_data, typename BaseType::OutputStorageType *output)
CompletionCallbackWithOutputBase(PP_CompletionCallback_Func func, void *user_data, int32_t flags, OutputStorageType *output)
Traits::StorageType OutputStorageType
PP_CompletionCallback cc_
void CallOnMainThread(int32_t delay_in_milliseconds, const CompletionCallback &callback, int32_t result=0)
CompletionCallback BlockUntilComplete()
CompletionCallbackWithOutputBase(PP_CompletionCallback_Func func, void *user_data, OutputStorageType *output)
CompletionCallback(PP_CompletionCallback_Func func, void *user_data, int32_t flags)
void set_flags(int32_t flags)
APIArgType output() const
CompletionCallback(PP_CompletionCallback_Func func, void *user_data)