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 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_H_ |
6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_ | 6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), | 200 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), |
201 "Line", IPC_MESSAGE_ID_LINE(msg.type())); | 201 "Line", IPC_MESSAGE_ID_LINE(msg.type())); |
202 ResourceMessageCallParams params(pp_resource(), next_sequence_number_++); | 202 ResourceMessageCallParams params(pp_resource(), next_sequence_number_++); |
203 // Stash the |callback| in |callbacks_| identified by the sequence number of | 203 // Stash the |callback| in |callbacks_| identified by the sequence number of |
204 // the call. | 204 // the call. |
205 scoped_refptr<PluginResourceCallbackBase> plugin_callback( | 205 scoped_refptr<PluginResourceCallbackBase> plugin_callback( |
206 new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback)); | 206 new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback)); |
207 callbacks_.insert(std::make_pair(params.sequence(), plugin_callback)); | 207 callbacks_.insert(std::make_pair(params.sequence(), plugin_callback)); |
208 params.set_has_callback(); | 208 params.set_has_callback(); |
209 | 209 |
210 if (resource_reply_thread_registrar_) { | 210 if (resource_reply_thread_registrar_.get()) { |
211 resource_reply_thread_registrar_->Register( | 211 resource_reply_thread_registrar_->Register( |
212 pp_resource(), params.sequence(), reply_thread_hint); | 212 pp_resource(), params.sequence(), reply_thread_hint); |
213 } | 213 } |
214 SendResourceCall(dest, params, msg); | 214 SendResourceCall(dest, params, msg); |
215 return params.sequence(); | 215 return params.sequence(); |
216 } | 216 } |
217 | 217 |
218 template <class ReplyMsgClass> | 218 template <class ReplyMsgClass> |
219 int32_t PluginResource::SyncCall(Destination dest, const IPC::Message& msg) { | 219 int32_t PluginResource::SyncCall(Destination dest, const IPC::Message& msg) { |
220 IPC::Message reply; | 220 IPC::Message reply; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e)) | 280 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e)) |
281 return result; | 281 return result; |
282 return PP_ERROR_FAILED; | 282 return PP_ERROR_FAILED; |
283 } | 283 } |
284 | 284 |
285 } // namespace proxy | 285 } // namespace proxy |
286 } // namespace ppapi | 286 } // namespace ppapi |
287 | 287 |
288 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_ | 288 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_ |
OLD | NEW |