Hello!
I'm new to NaCl, and I'm not a C++ developer :) I'm trying to emulate blocking thread in JS. I use postMessageAndAwaitResponse.
The issue, that I get an exception:
Uncaught Error: The plugin has not registered a handler for synchronous messages. See the documentation for PPB_Messaging::RegisterMessageHandler and PPP_MessageHandler.
Here's my C++ code:
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/message_handler.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/var.h"
#include "ppapi/cpp/message_loop.h"
class HelloTutorialInstance : public pp::MessageHandler, public pp::Instance {
public:
explicit HelloTutorialInstance(PP_Instance instance)
: pp::Instance(instance) {
pp::MessageLoop loop;
this->RegisterMessageHandler(this, loop);
}
virtual pp::Var HandleBlockingMessage(pp::InstanceHandle instance,
const pp::Var &var) {
return var;
}
virtual void HandleMessage(const pp::Var &message) {
}
virtual void HandleMessage(pp::InstanceHandle instance, const pp::Var &var) {
}
virtual void WasUnregistered(pp::InstanceHandle instance) {
}
};
class HelloTutorialModule : public pp::Module {
public:
HelloTutorialModule() : pp::Module() {
}
virtual ~HelloTutorialModule() {
}
virtual pp::Instance *CreateInstance(PP_Instance instance) {
return new HelloTutorialInstance(instance);
}
};
namespace pp {
Module *CreateModule() {
return new HelloTutorialModule();
}
}
But after code rebuild I still get the same error. What is wrong with my code?