Release ppp_class_data in mocked V8ObjectVar.
The CreateObject implementation should release the ppp_class_data when it goes out of scope. Bug: 258113 Change-Id: I563c6b5234f5ac94fed4fd43ce69c448e54866de Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539692 Reviewed-by: Bill Budge <bbudge@chromium.org> Commit-Queue: David Benjamin <davidben@chromium.org> Cr-Commit-Position: refs/heads/master@{#644512}
This commit is contained in:

committed by
Commit Bot

parent
33941ad812
commit
1ad71d5814
@ -53,10 +53,6 @@ char kLSanDefaultSuppressions[] =
|
||||
// impossible, i.e. when enabling leak detection for the first time for a
|
||||
// test target with pre-existing leaks.
|
||||
|
||||
// Small test-only leak in ppapi_unittests. http://crbug.com/258113
|
||||
"leak:ppapi::proxy::PPP_Instance_Private_ProxyTest_PPPInstancePrivate_"
|
||||
"Test\n"
|
||||
|
||||
// http://crbug.com/356306
|
||||
"leak:service_manager::SetProcessTitleFromCommandLine\n"
|
||||
|
||||
|
@ -25,12 +25,17 @@ namespace ppapi {
|
||||
// A fake version of V8ObjectVar for testing.
|
||||
class V8ObjectVar : public ppapi::Var {
|
||||
public:
|
||||
V8ObjectVar() {}
|
||||
~V8ObjectVar() override {}
|
||||
V8ObjectVar(const PPP_Class_Deprecated* ppp_class, void* ppp_class_data)
|
||||
: ppp_class_(ppp_class), ppp_class_data_(ppp_class_data) {}
|
||||
~V8ObjectVar() override { ppp_class_->Deallocate(ppp_class_data_); }
|
||||
|
||||
// Var overrides.
|
||||
V8ObjectVar* AsV8ObjectVar() override { return this; }
|
||||
PP_VarType GetType() const override { return PP_VARTYPE_OBJECT; }
|
||||
|
||||
private:
|
||||
const PPP_Class_Deprecated* ppp_class_;
|
||||
void* ppp_class_data_;
|
||||
};
|
||||
|
||||
namespace proxy {
|
||||
@ -110,9 +115,9 @@ PPP_Instance_1_0 ppp_instance_mock = { &DidCreate, &DidDestroy };
|
||||
|
||||
// Mock PPB_Var_Deprecated, so that we can emulate creating an Object Var.
|
||||
PP_Var CreateObject(PP_Instance /*instance*/,
|
||||
const PPP_Class_Deprecated* /*ppp_class*/,
|
||||
void* /*ppp_class_data*/) {
|
||||
V8ObjectVar* obj_var = new V8ObjectVar;
|
||||
const PPP_Class_Deprecated* ppp_class,
|
||||
void* ppp_class_data) {
|
||||
V8ObjectVar* obj_var = new V8ObjectVar(ppp_class, ppp_class_data);
|
||||
return obj_var->GetPPVar();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user