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

Side by Side Diff: ppapi/host/resource_message_handler.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/host/resource_message_handler.h"
6
7 #include "ipc/ipc_message.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/host/host_message_context.h"
10
11 namespace ppapi {
12 namespace host {
13
14 ResourceMessageHandler::ResourceMessageHandler() {
15 }
16
17 ResourceMessageHandler::~ResourceMessageHandler() {
18 }
19
20 void ResourceMessageHandler::RunMessageHandlerAndReply(
21 const IPC::Message& msg,
22 HostMessageContext* context) {
23 ReplyMessageContext reply_context = context->MakeReplyMessageContext();
24 reply_context.params.set_result(OnResourceMessageReceived(msg, context));
25
26 // Sanity check the resource handler. Note if the result was
27 // "completion pending" the resource host may have already sent the reply.
28 if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) {
29 // Message handler should have only returned a pending result if a
30 // response will be sent to the plugin.
31 DCHECK(context->params.has_callback());
32
33 // Message handler should not have written a message to be returned if
34 // completion is pending.
35 DCHECK(context->reply_msg.type() == 0);
36 } else if (!context->params.has_callback()) {
37 // When no response is required, the message handler should not have
38 // written a message to be returned.
39 DCHECK(context->reply_msg.type() == 0);
40 }
41
42 if (context->params.has_callback() &&
43 reply_context.params.result() != PP_OK_COMPLETIONPENDING)
44 SendReply(reply_context, context->reply_msg);
45 }
46
47 int32_t ResourceMessageHandler::OnResourceMessageReceived(
48 const IPC::Message& msg,
49 HostMessageContext* context) {
50 return PP_ERROR_NOTSUPPORTED;
51 }
52
53 } // namespace host
54 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698