This source file includes following definitions.
- RunMessageHandlerAndReply
- OnResourceMessageReceived
#include "ppapi/host/resource_message_handler.h"
#include "base/logging.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/host_message_context.h"
namespace ppapi {
namespace host {
ResourceMessageHandler::ResourceMessageHandler() {
}
ResourceMessageHandler::~ResourceMessageHandler() {
}
void ResourceMessageHandler::RunMessageHandlerAndReply(
const IPC::Message& msg,
HostMessageContext* context) {
ReplyMessageContext reply_context = context->MakeReplyMessageContext();
reply_context.params.set_result(OnResourceMessageReceived(msg, context));
if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) {
DCHECK(context->params.has_callback());
DCHECK(context->reply_msg.type() == 0);
} else if (!context->params.has_callback()) {
DCHECK(context->reply_msg.type() == 0);
DLOG_IF(WARNING, reply_context.params.result() != PP_OK)
<< "'Post' message handler failed to complete successfully.";
}
if (context->params.has_callback() &&
reply_context.params.result() != PP_OK_COMPLETIONPENDING)
SendReply(reply_context, context->reply_msg);
}
int32_t ResourceMessageHandler::OnResourceMessageReceived(
const IPC::Message& msg,
HostMessageContext* context) {
return PP_ERROR_NOTSUPPORTED;
}
}
}