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