OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ppp_class_proxy.h" | 5 #include "ppapi/proxy/ppp_class_proxy.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_var_deprecated.h" | 7 #include "ppapi/c/dev/ppb_var_deprecated.h" |
8 #include "ppapi/c/dev/ppp_class_deprecated.h" | 8 #include "ppapi/c/dev/ppp_class_deprecated.h" |
9 #include "ppapi/proxy/dispatcher.h" | 9 #include "ppapi/proxy/dispatcher.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| 11 #include "ppapi/shared_impl/proxy_lock.h" |
11 #include "ppapi/proxy/serialized_var.h" | 12 #include "ppapi/proxy/serialized_var.h" |
12 #include "ppapi/shared_impl/api_id.h" | 13 #include "ppapi/shared_impl/api_id.h" |
13 | 14 |
14 namespace ppapi { | 15 namespace ppapi { |
15 namespace proxy { | 16 namespace proxy { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // PPP_Class in the browser implementation ------------------------------------- | 20 // PPP_Class in the browser implementation ------------------------------------- |
20 | 21 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 OnMsgDeallocate) | 237 OnMsgDeallocate) |
237 IPC_MESSAGE_UNHANDLED(handled = false) | 238 IPC_MESSAGE_UNHANDLED(handled = false) |
238 IPC_END_MESSAGE_MAP() | 239 IPC_END_MESSAGE_MAP() |
239 return handled; | 240 return handled; |
240 } | 241 } |
241 | 242 |
242 void PPP_Class_Proxy::OnMsgHasProperty(int64 ppp_class, int64 object, | 243 void PPP_Class_Proxy::OnMsgHasProperty(int64 ppp_class, int64 object, |
243 SerializedVarReceiveInput property, | 244 SerializedVarReceiveInput property, |
244 SerializedVarOutParam exception, | 245 SerializedVarOutParam exception, |
245 bool* result) { | 246 bool* result) { |
246 *result = ToPPPClass(ppp_class)->HasProperty(ToUserData(object), | 247 *result = CallWhileUnlocked(ToPPPClass(ppp_class)->HasProperty, |
247 property.Get(dispatcher()), exception.OutParam(dispatcher())); | 248 ToUserData(object), |
| 249 property.Get(dispatcher()), |
| 250 exception.OutParam(dispatcher())); |
248 } | 251 } |
249 | 252 |
250 void PPP_Class_Proxy::OnMsgHasMethod(int64 ppp_class, int64 object, | 253 void PPP_Class_Proxy::OnMsgHasMethod(int64 ppp_class, int64 object, |
251 SerializedVarReceiveInput property, | 254 SerializedVarReceiveInput property, |
252 SerializedVarOutParam exception, | 255 SerializedVarOutParam exception, |
253 bool* result) { | 256 bool* result) { |
254 *result = ToPPPClass(ppp_class)->HasMethod(ToUserData(object), | 257 *result = CallWhileUnlocked(ToPPPClass(ppp_class)->HasMethod, |
255 property.Get(dispatcher()), exception.OutParam(dispatcher())); | 258 ToUserData(object), |
| 259 property.Get(dispatcher()), |
| 260 exception.OutParam(dispatcher())); |
256 } | 261 } |
257 | 262 |
258 void PPP_Class_Proxy::OnMsgGetProperty(int64 ppp_class, int64 object, | 263 void PPP_Class_Proxy::OnMsgGetProperty(int64 ppp_class, int64 object, |
259 SerializedVarReceiveInput property, | 264 SerializedVarReceiveInput property, |
260 SerializedVarOutParam exception, | 265 SerializedVarOutParam exception, |
261 SerializedVarReturnValue result) { | 266 SerializedVarReturnValue result) { |
262 result.Return(dispatcher(), ToPPPClass(ppp_class)->GetProperty( | 267 result.Return(dispatcher(), CallWhileUnlocked( |
| 268 ToPPPClass(ppp_class)->GetProperty, |
263 ToUserData(object), property.Get(dispatcher()), | 269 ToUserData(object), property.Get(dispatcher()), |
264 exception.OutParam(dispatcher()))); | 270 exception.OutParam(dispatcher()))); |
265 } | 271 } |
266 | 272 |
267 void PPP_Class_Proxy::OnMsgEnumerateProperties( | 273 void PPP_Class_Proxy::OnMsgEnumerateProperties( |
268 int64 ppp_class, int64 object, | 274 int64 ppp_class, int64 object, |
269 std::vector<SerializedVar>* props, | 275 std::vector<SerializedVar>* props, |
270 SerializedVarOutParam exception) { | 276 SerializedVarOutParam exception) { |
271 NOTIMPLEMENTED(); | 277 NOTIMPLEMENTED(); |
272 // TODO(brettw) implement this. | 278 // TODO(brettw) implement this. |
273 } | 279 } |
274 | 280 |
275 void PPP_Class_Proxy::OnMsgSetProperty(int64 ppp_class, int64 object, | 281 void PPP_Class_Proxy::OnMsgSetProperty(int64 ppp_class, int64 object, |
276 SerializedVarReceiveInput property, | 282 SerializedVarReceiveInput property, |
277 SerializedVarReceiveInput value, | 283 SerializedVarReceiveInput value, |
278 SerializedVarOutParam exception) { | 284 SerializedVarOutParam exception) { |
279 ToPPPClass(ppp_class)->SetProperty( | 285 CallWhileUnlocked(ToPPPClass(ppp_class)->SetProperty, |
280 ToUserData(object), property.Get(dispatcher()), value.Get(dispatcher()), | 286 ToUserData(object), property.Get(dispatcher()), value.Get(dispatcher()), |
281 exception.OutParam(dispatcher())); | 287 exception.OutParam(dispatcher())); |
282 } | 288 } |
283 | 289 |
284 void PPP_Class_Proxy::OnMsgRemoveProperty(int64 ppp_class, int64 object, | 290 void PPP_Class_Proxy::OnMsgRemoveProperty(int64 ppp_class, int64 object, |
285 SerializedVarReceiveInput property, | 291 SerializedVarReceiveInput property, |
286 SerializedVarOutParam exception) { | 292 SerializedVarOutParam exception) { |
287 ToPPPClass(ppp_class)->RemoveProperty( | 293 CallWhileUnlocked(ToPPPClass(ppp_class)->RemoveProperty, |
288 ToUserData(object), property.Get(dispatcher()), | 294 ToUserData(object), property.Get(dispatcher()), |
289 exception.OutParam(dispatcher())); | 295 exception.OutParam(dispatcher())); |
290 } | 296 } |
291 | 297 |
292 void PPP_Class_Proxy::OnMsgCall( | 298 void PPP_Class_Proxy::OnMsgCall( |
293 int64 ppp_class, int64 object, | 299 int64 ppp_class, int64 object, |
294 SerializedVarReceiveInput method_name, | 300 SerializedVarReceiveInput method_name, |
295 SerializedVarVectorReceiveInput arg_vector, | 301 SerializedVarVectorReceiveInput arg_vector, |
296 SerializedVarOutParam exception, | 302 SerializedVarOutParam exception, |
297 SerializedVarReturnValue result) { | 303 SerializedVarReturnValue result) { |
298 uint32_t arg_count = 0; | 304 uint32_t arg_count = 0; |
299 PP_Var* args = arg_vector.Get(dispatcher(), &arg_count); | 305 PP_Var* args = arg_vector.Get(dispatcher(), &arg_count); |
300 result.Return(dispatcher(), ToPPPClass(ppp_class)->Call( | 306 result.Return(dispatcher(), CallWhileUnlocked(ToPPPClass(ppp_class)->Call, |
301 ToUserData(object), method_name.Get(dispatcher()), | 307 ToUserData(object), method_name.Get(dispatcher()), |
302 arg_count, args, exception.OutParam(dispatcher()))); | 308 arg_count, args, exception.OutParam(dispatcher()))); |
303 } | 309 } |
304 | 310 |
305 void PPP_Class_Proxy::OnMsgConstruct( | 311 void PPP_Class_Proxy::OnMsgConstruct( |
306 int64 ppp_class, int64 object, | 312 int64 ppp_class, int64 object, |
307 SerializedVarVectorReceiveInput arg_vector, | 313 SerializedVarVectorReceiveInput arg_vector, |
308 SerializedVarOutParam exception, | 314 SerializedVarOutParam exception, |
309 SerializedVarReturnValue result) { | 315 SerializedVarReturnValue result) { |
310 uint32_t arg_count = 0; | 316 uint32_t arg_count = 0; |
311 PP_Var* args = arg_vector.Get(dispatcher(), &arg_count); | 317 PP_Var* args = arg_vector.Get(dispatcher(), &arg_count); |
312 result.Return(dispatcher(), ToPPPClass(ppp_class)->Construct( | 318 result.Return(dispatcher(), CallWhileUnlocked( |
| 319 ToPPPClass(ppp_class)->Construct, |
313 ToUserData(object), arg_count, args, exception.OutParam(dispatcher()))); | 320 ToUserData(object), arg_count, args, exception.OutParam(dispatcher()))); |
314 } | 321 } |
315 | 322 |
316 void PPP_Class_Proxy::OnMsgDeallocate(int64 ppp_class, int64 object) { | 323 void PPP_Class_Proxy::OnMsgDeallocate(int64 ppp_class, int64 object) { |
317 ToPPPClass(ppp_class)->Deallocate(ToUserData(object)); | 324 CallWhileUnlocked(ToPPPClass(ppp_class)->Deallocate, ToUserData(object)); |
318 } | 325 } |
319 | 326 |
320 } // namespace proxy | 327 } // namespace proxy |
321 } // namespace ppapi | 328 } // namespace ppapi |
OLD | NEW |