pp::MessageHandler Class Reference

List of all members.

Public Member Functions

virtual ~MessageHandler ()
virtual void HandleMessage (pp::InstanceHandle instance, const Var &message_data)=0
virtual pp::Var HandleBlockingMessage (pp::InstanceHandle instance, const Var &message_data)=0
virtual void WasUnregistered (pp::InstanceHandle instance)=0

Detailed Description

MessageHandler is an abstract base class that the plugin may implement if it wants to receive messages from JavaScript on a background thread when JavaScript invokes postMessage() or postMessageAndAwaitResponse().

See pp::Instance::RegisterMessageHandler() for usage.


Constructor & Destructor Documentation

virtual pp::MessageHandler::~MessageHandler ( ) [inline, virtual]

Member Function Documentation

virtual pp::Var pp::MessageHandler::HandleBlockingMessage ( pp::InstanceHandle  instance,
const Var message_data 
) [pure virtual]

Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() on the plugin's DOM element.

NOTE: JavaScript execution is blocked during the duration of this call. Hence, the plugin should respond as quickly as possible. For this reason, blocking completion callbacks are disallowed while handling a blocking message.

Parameters:
[in]instanceAn InstanceHandle identifying one instance of a module.
[in]message_dataA copy of the parameter that JavaScript provided to postMessage().
Returns:
Returns a pp::Var that is then copied to a JavaScript object which is returned as the result of JavaScript's call of postMessageAndAwaitResponse().
virtual void pp::MessageHandler::HandleMessage ( pp::InstanceHandle  instance,
const Var message_data 
) [pure virtual]

Invoked as a result of JavaScript invoking postMessage() on the plugin's DOM element.

Parameters:
[in]instanceAn InstanceHandle identifying one instance of a module.
[in]message_dataA copy of the parameter that JavaScript provided to postMessage().
virtual void pp::MessageHandler::WasUnregistered ( pp::InstanceHandle  instance) [pure virtual]

Invoked when this MessageHandler is no longer needed.

After this, no more calls will be made to this object.

Parameters:
[in]instanceAn InstanceHandle identifying one instance of a module.

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