| OLD | NEW |
| 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/ppapi_host.h" | 5 #include "ppapi/host/ppapi_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/host/host_factory.h" | 9 #include "ppapi/host/host_factory.h" |
| 10 #include "ppapi/host/host_message_context.h" | 10 #include "ppapi/host/host_message_context.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // response will be sent to the plugin. | 132 // response will be sent to the plugin. |
| 133 DCHECK(params.has_callback()); | 133 DCHECK(params.has_callback()); |
| 134 | 134 |
| 135 // Message handler should not have written a message to be returned if | 135 // Message handler should not have written a message to be returned if |
| 136 // completion is pending. | 136 // completion is pending. |
| 137 DCHECK(context->reply_msg.type() == 0); | 137 DCHECK(context->reply_msg.type() == 0); |
| 138 } else if (!params.has_callback()) { | 138 } else if (!params.has_callback()) { |
| 139 // When no response is required, the message handler should not have | 139 // When no response is required, the message handler should not have |
| 140 // written a message to be returned. | 140 // written a message to be returned. |
| 141 DCHECK(context->reply_msg.type() == 0); | 141 DCHECK(context->reply_msg.type() == 0); |
| 142 |
| 143 // If there is no callback and the result of running the message handler |
| 144 // was not PP_OK the client won't find out. |
| 145 DLOG_IF(WARNING, reply_context.params.result() != PP_OK) |
| 146 << "'Post' message handler failed to complete successfully."; |
| 142 } | 147 } |
| 143 } else { | 148 } else { |
| 144 reply_context.params.set_result(PP_ERROR_BADRESOURCE); | 149 reply_context.params.set_result(PP_ERROR_BADRESOURCE); |
| 145 } | 150 } |
| 146 | 151 |
| 147 if (params.has_callback() && | 152 if (params.has_callback() && |
| 148 reply_context.params.result() != PP_OK_COMPLETIONPENDING) | 153 reply_context.params.result() != PP_OK_COMPLETIONPENDING) |
| 149 SendReply(reply_context, context->reply_msg); | 154 SendReply(reply_context, context->reply_msg); |
| 150 } | 155 } |
| 151 | 156 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 resources_.erase(found); | 188 resources_.erase(found); |
| 184 } | 189 } |
| 185 | 190 |
| 186 ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) { | 191 ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) { |
| 187 ResourceMap::iterator found = resources_.find(resource); | 192 ResourceMap::iterator found = resources_.find(resource); |
| 188 return found == resources_.end() ? NULL : found->second.get(); | 193 return found == resources_.end() ? NULL : found->second.get(); |
| 189 } | 194 } |
| 190 | 195 |
| 191 } // namespace host | 196 } // namespace host |
| 192 } // namespace ppapi | 197 } // namespace ppapi |
| OLD | NEW |