| 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/proxy/plugin_resource.h" | 5 #include "ppapi/proxy/plugin_resource.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | |
| 8 #include "ppapi/proxy/ppapi_messages.h" | 7 #include "ppapi/proxy/ppapi_messages.h" |
| 9 #include "ppapi/proxy/resource_message_params.h" | 8 #include "ppapi/proxy/resource_message_params.h" |
| 10 | 9 |
| 11 namespace ppapi { | 10 namespace ppapi { |
| 12 namespace proxy { | 11 namespace proxy { |
| 13 | 12 |
| 14 PluginResource::PluginResource(Connection connection, PP_Instance instance) | 13 PluginResource::PluginResource(Connection connection, PP_Instance instance) |
| 15 : Resource(OBJECT_IS_PROXY, instance), | 14 : Resource(OBJECT_IS_PROXY, instance), |
| 16 connection_(connection), | 15 connection_(connection), |
| 17 next_sequence_number_(0), | 16 next_sequence_number_(0), |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 SendResourceCall(connection_.renderer_sender, params, msg); | 73 SendResourceCall(connection_.renderer_sender, params, msg); |
| 75 } | 74 } |
| 76 | 75 |
| 77 bool PluginResource::SendResourceCall( | 76 bool PluginResource::SendResourceCall( |
| 78 IPC::Sender* sender, | 77 IPC::Sender* sender, |
| 79 const ResourceMessageCallParams& call_params, | 78 const ResourceMessageCallParams& call_params, |
| 80 const IPC::Message& nested_msg) { | 79 const IPC::Message& nested_msg) { |
| 81 return sender->Send(new PpapiHostMsg_ResourceCall(call_params, nested_msg)); | 80 return sender->Send(new PpapiHostMsg_ResourceCall(call_params, nested_msg)); |
| 82 } | 81 } |
| 83 | 82 |
| 84 int32_t PluginResource::CallBrowserSync(const IPC::Message& msg, | 83 int32_t PluginResource::GenericSyncCall(Destination dest, |
| 84 const IPC::Message& msg, |
| 85 IPC::Message* reply) { | 85 IPC::Message* reply) { |
| 86 ResourceMessageCallParams params(pp_resource(), | 86 ResourceMessageCallParams params(pp_resource(), |
| 87 next_sequence_number_++); | 87 next_sequence_number_++); |
| 88 params.set_has_callback(); | 88 params.set_has_callback(); |
| 89 ResourceMessageReplyParams reply_params; | 89 ResourceMessageReplyParams reply_params; |
| 90 bool success = | 90 bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall( |
| 91 connection_.browser_sender->Send(new PpapiHostMsg_ResourceSyncCall( | 91 params, msg, &reply_params, reply)); |
| 92 params, msg, &reply_params, reply)); | |
| 93 if (success) | 92 if (success) |
| 94 return reply_params.result(); | 93 return reply_params.result(); |
| 95 return PP_ERROR_FAILED; | 94 return PP_ERROR_FAILED; |
| 96 } | |
| 97 | |
| 98 int32_t PluginResource::CallRendererSync(const IPC::Message& msg, | |
| 99 IPC::Message* reply) { | |
| 100 ResourceMessageCallParams params(pp_resource(), | |
| 101 next_sequence_number_++); | |
| 102 params.set_has_callback(); | |
| 103 ResourceMessageReplyParams reply_params; | |
| 104 bool success = | |
| 105 connection_.renderer_sender->Send(new PpapiHostMsg_ResourceSyncCall( | |
| 106 params, msg, &reply_params, reply)); | |
| 107 if (success) | |
| 108 return reply_params.result(); | |
| 109 return PP_ERROR_FAILED; | |
| 110 } | 95 } |
| 111 | 96 |
| 112 } // namespace proxy | 97 } // namespace proxy |
| 113 } // namespace ppapi | 98 } // namespace ppapi |
| OLD | NEW |