Native Client

pp::CompletionCallbackWithOutput< T > Class Template Reference

A CompletionCallbackWithOutput defines a completion callback that additionally stores a pointer to some output data. More...

Inheritance diagram for pp::CompletionCallbackWithOutput< T >:

List of all members.

Public Types

typedef
internal::CompletionCallbackWithOutputBase
< T,
internal::CallbackOutputTraits
< T > > 
BaseType

Public Functions

 CompletionCallbackWithOutput (typename BaseType::OutputStorageType *output)
 CompletionCallbackWithOutput (PP_CompletionCallback_Func func, void *user_data, typename BaseType::OutputStorageType *output)
 CompletionCallbackWithOutput (PP_CompletionCallback_Func func, void *user_data, int32_t flags, typename BaseType::OutputStorageType *output)

Detailed Description

template
class pp::CompletionCallbackWithOutput< T >

A CompletionCallbackWithOutput defines a completion callback that additionally stores a pointer to some output data.

Some C++ wrappers take a CompletionCallbackWithOutput when the browser is returning a bit of data as part of the function call. The "output" parameter stored in the CompletionCallbackWithOutput will receive the data from the browser.

You can create this yourself, but it is most common to use with the CompletionCallbackFactory's NewCallbackWithOutput, which manages the storage for the output parameter for you and passes it as an argument to your callback function.

Note that this class doesn't actually do anything with the output data, it just stores a pointer to it. C++ wrapper objects that accept a CompletionCallbackWithOutput will retrieve this pointer and pass it to the browser as the output parameter.


Member Typedef Documentation

template
typedef internal::CompletionCallbackWithOutputBase< T, internal::CallbackOutputTraits > pp::CompletionCallbackWithOutput< T >::BaseType

Constructor and Destructor Details

template
pp::CompletionCallbackWithOutput< T >::CompletionCallbackWithOutput ( typename BaseType::OutputStorageType output) [inline, explicit]

The default constructor will create a blocking CompletionCallbackWithOutput that references the given output data.

Parameters:
[in]outputA pointer to the data associated with the callback. The caller must ensure that this pointer outlives the completion callback. In the common case, OutputStorageType will be equal to the template parameter T (for example, CompletionCallbackWithOutput would obviously take an int*. However, resources are passed as PP_Resource, vars as PP_Var, and arrays as our special ArrayOutputAdapter object. internal::CallbackOutputTraits defines specializations for all of these cases.

Note: Blocking completion callbacks are only allowed from background threads.

template
pp::CompletionCallbackWithOutput< T >::CompletionCallbackWithOutput ( PP_CompletionCallback_Func  func,
void *  user_data,
typename BaseType::OutputStorageType output 
) [inline]

A constructor for creating a CompletionCallbackWithOutput that references the given output data.

Parameters:
[in]funcThe function to be called on completion.
[in]user_dataThe user data to be passed to the callback function. This is optional and is typically used to help track state in case of multiple pending callbacks.
[in]outputA pointer to the data associated with the callback. The caller must ensure that this pointer outlives the completion callback.
template
pp::CompletionCallbackWithOutput< T >::CompletionCallbackWithOutput ( PP_CompletionCallback_Func  func,
void *  user_data,
int32_t  flags,
typename BaseType::OutputStorageType output 
) [inline]

A constructor for creating a CompletionCallbackWithOutput that references the given output data.

Parameters:
[in]funcThe function to be called on completion.
[in]user_dataThe user data to be passed to the callback function. This is optional and is typically used to help track state in case of multiple pending callbacks.
[in]flagsBit field combination of PP_CompletionCallback_Flag flags used to control how non-NULL callbacks are scheduled by asynchronous methods.
[in]outputA pointer to the data associated with the callback. The caller must ensure that this pointer outlives the completion callback.

The documentation for this class was generated from the following file:

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.