Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: ppapi/host/ppapi_host.cc

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/host/ppapi_host.cc
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 44d3ee5d390149618a2fb105e6cd3b213aba3f11..7a9b4b6378481ac0291addc5dd039ecb2de81e01 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -118,40 +118,16 @@ void PpapiHost::HandleResourceCall(
const proxy::ResourceMessageCallParams& params,
const IPC::Message& nested_msg,
HostMessageContext* context) {
- ReplyMessageContext reply_context = context->MakeReplyMessageContext();
-
ResourceHost* resource_host = GetResourceHost(params.pp_resource());
if (resource_host) {
- reply_context.params.set_result(
- resource_host->OnResourceMessageReceived(nested_msg, context));
-
- // Sanity check the resource handler. Note if the result was
- // "completion pending" the resource host may have already sent the reply.
- if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) {
- // Message handler should have only returned a pending result if a
- // response will be sent to the plugin.
- DCHECK(params.has_callback());
-
- // Message handler should not have written a message to be returned if
- // completion is pending.
- DCHECK(context->reply_msg.type() == 0);
- } else if (!params.has_callback()) {
- // When no response is required, the message handler should not have
- // written a message to be returned.
- DCHECK(context->reply_msg.type() == 0);
-
- // If there is no callback and the result of running the message handler
- // was not PP_OK the client won't find out.
- DLOG_IF(WARNING, reply_context.params.result() != PP_OK)
- << "'Post' message handler failed to complete successfully.";
- }
+ resource_host->HandleMessage(nested_msg, context);
} else {
- reply_context.params.set_result(PP_ERROR_BADRESOURCE);
+ if (context->params.has_callback()) {
+ ReplyMessageContext reply_context = context->MakeReplyMessageContext();
+ reply_context.params.set_result(PP_ERROR_BADRESOURCE);
+ SendReply(reply_context, context->reply_msg);
+ }
}
-
- if (params.has_callback() &&
- reply_context.params.result() != PP_OK_COMPLETIONPENDING)
- SendReply(reply_context, context->reply_msg);
}
void PpapiHost::OnHostMsgResourceCreated(

Powered by Google App Engine
This is Rietveld 408576698