Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: ppapi/proxy/ppp_class_proxy.cc

Issue 10678007: Invoke PluginImplementedObjectDestroyed for ppp_class deallocate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove object from global list before Deallocate Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/plugin_var_tracker_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 uint32_t arg_count = 0; 334 uint32_t arg_count = 0;
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 PluginGlobals::Get()->plugin_var_tracker()->PluginImplementedObjectDestroyed(
345 ToUserData(object));
344 CallWhileUnlocked(ToPPPClass(ppp_class)->Deallocate, ToUserData(object)); 346 CallWhileUnlocked(ToPPPClass(ppp_class)->Deallocate, 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
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_var_tracker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698