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

Side by Side Diff: ppapi/host/resource_message_handler.cc

Issue 11510008: Refactor 4 PPB_Flash functions to the new PPAPI resource model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
« no previous file with comments | « ppapi/host/ppapi_host.cc ('k') | ppapi/proxy/flash_resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/host/resource_message_handler.h" 5 #include "ppapi/host/resource_message_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ipc/ipc_message.h" 8 #include "ipc/ipc_message.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/host/host_message_context.h" 10 #include "ppapi/host/host_message_context.h"
11 11
12 namespace ppapi { 12 namespace ppapi {
13 namespace host { 13 namespace host {
14 14
15 ResourceMessageHandler::ResourceMessageHandler() { 15 ResourceMessageHandler::ResourceMessageHandler() {
16 } 16 }
17 17
18 ResourceMessageHandler::~ResourceMessageHandler() { 18 ResourceMessageHandler::~ResourceMessageHandler() {
19 } 19 }
20 20
21 void ResourceMessageHandler::RunMessageHandlerAndReply( 21 void ResourceMessageHandler::RunMessageHandlerAndReply(
22 const IPC::Message& msg, 22 const IPC::Message& msg,
23 HostMessageContext* context) { 23 HostMessageContext* context) {
24 ReplyMessageContext reply_context = context->MakeReplyMessageContext(); 24 ReplyMessageContext reply_context = context->MakeReplyMessageContext();
25 // CAUTION: Handling the message may cause the destruction of this object.
26 // The message handler should ensure that if there is a chance that the
27 // object will be destroyed, PP_OK_COMPLETIONPENDING is returned as the
28 // result of the message handler. Otherwise the code below will attempt to
29 // send a reply message on a destroyed object.
25 reply_context.params.set_result(OnResourceMessageReceived(msg, context)); 30 reply_context.params.set_result(OnResourceMessageReceived(msg, context));
26 31
27 // Sanity check the resource handler. Note if the result was 32 // Sanity check the resource handler. Note if the result was
28 // "completion pending" the resource host may have already sent the reply. 33 // "completion pending" the resource host may have already sent the reply.
29 if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) { 34 if (reply_context.params.result() == PP_OK_COMPLETIONPENDING) {
30 // Message handler should have only returned a pending result if a 35 // Message handler should have only returned a pending result if a
31 // response will be sent to the plugin. 36 // response will be sent to the plugin.
32 DCHECK(context->params.has_callback()); 37 DCHECK(context->params.has_callback());
33 38
34 // Message handler should not have written a message to be returned if 39 // Message handler should not have written a message to be returned if
(...skipping 16 matching lines...) Expand all
51 } 56 }
52 57
53 int32_t ResourceMessageHandler::OnResourceMessageReceived( 58 int32_t ResourceMessageHandler::OnResourceMessageReceived(
54 const IPC::Message& msg, 59 const IPC::Message& msg,
55 HostMessageContext* context) { 60 HostMessageContext* context) {
56 return PP_ERROR_NOTSUPPORTED; 61 return PP_ERROR_NOTSUPPORTED;
57 } 62 }
58 63
59 } // namespace host 64 } // namespace host
60 } // namespace ppapi 65 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/host/ppapi_host.cc ('k') | ppapi/proxy/flash_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698