Chromium Code Reviews| 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/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/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/proxy/dispatcher.h" | 10 #include "ppapi/proxy/dispatcher.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 PP_Var* args = arg_vector.Get(dispatcher(), &arg_count); | 335 PP_Var* args = arg_vector.Get(dispatcher(), &arg_count); |
| 336 result.Return(dispatcher(), CallWhileUnlocked( | 336 result.Return(dispatcher(), CallWhileUnlocked( |
| 337 ToPPPClass(ppp_class)->Construct, | 337 ToPPPClass(ppp_class)->Construct, |
| 338 ToUserData(object), arg_count, args, exception.OutParam(dispatcher()))); | 338 ToUserData(object), arg_count, args, exception.OutParam(dispatcher()))); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void PPP_Class_Proxy::OnMsgDeallocate(int64 ppp_class, int64 object) { | 341 void PPP_Class_Proxy::OnMsgDeallocate(int64 ppp_class, int64 object) { |
| 342 if (!ValidateUserData(ppp_class, object, NULL)) | 342 if (!ValidateUserData(ppp_class, object, NULL)) |
| 343 return; | 343 return; |
| 344 CallWhileUnlocked(ToPPPClass(ppp_class)->Deallocate, ToUserData(object)); | 344 CallWhileUnlocked(ToPPPClass(ppp_class)->Deallocate, ToUserData(object)); |
| 345 PluginGlobals::Get()->plugin_var_tracker()->PluginImplementedObjectDestroyed( | |
|
brettw
2012/06/27 05:22:38
Actually, I'd feel slightly better if this was mov
Josh Horwich
2012/06/27 17:03:55
Done.
| |
| 346 ToUserData(object)); | |
| 345 } | 347 } |
| 346 | 348 |
| 347 bool PPP_Class_Proxy::ValidateUserData(int64 ppp_class, int64 class_data, | 349 bool PPP_Class_Proxy::ValidateUserData(int64 ppp_class, int64 class_data, |
| 348 SerializedVarOutParam* exception) { | 350 SerializedVarOutParam* exception) { |
| 349 if (!PluginGlobals::Get()->plugin_var_tracker()->ValidatePluginObjectCall( | 351 if (!PluginGlobals::Get()->plugin_var_tracker()->ValidatePluginObjectCall( |
| 350 ToPPPClass(ppp_class), ToUserData(class_data))) { | 352 ToPPPClass(ppp_class), ToUserData(class_data))) { |
| 351 // Set the exception. This is so the caller will know about the error and | 353 // Set the exception. This is so the caller will know about the error and |
| 352 // also that we won't assert that somebody forgot to call OutParam on the | 354 // also that we won't assert that somebody forgot to call OutParam on the |
| 353 // output parameter. Although this exception of "1" won't be very useful | 355 // output parameter. Although this exception of "1" won't be very useful |
| 354 // this shouldn't happen in normal usage, only when the renderer is being | 356 // this shouldn't happen in normal usage, only when the renderer is being |
| 355 // malicious. | 357 // malicious. |
| 356 if (exception) | 358 if (exception) |
| 357 *exception->OutParam(dispatcher()) = PP_MakeInt32(1); | 359 *exception->OutParam(dispatcher()) = PP_MakeInt32(1); |
| 358 return false; | 360 return false; |
| 359 } | 361 } |
| 360 return true; | 362 return true; |
| 361 } | 363 } |
| 362 | 364 |
| 363 } // namespace proxy | 365 } // namespace proxy |
| 364 } // namespace ppapi | 366 } // namespace ppapi |
| OLD | NEW |