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

Unified Diff: ppapi/shared_impl/var.cc

Issue 8872065: Pepper: Var keeps invalid var_id if VarTracker release it and there is another reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix pp_var issue and add leak check Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/tests/test_case.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/var.cc
diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc
index 3bec5ce3ade7468bef7c7ae7a9b4ec62e3c5d95a..ecfb71484678dadcfff8558891fc5beeff3ed096 100644
--- a/ppapi/shared_impl/var.cc
+++ b/ppapi/shared_impl/var.cc
@@ -99,13 +99,17 @@ void Var::AssignVarID(int32 id) {
StringVar::StringVar(const std::string& str)
: value_(str) {
+ GetOrCreateVarID();
}
StringVar::StringVar(const char* str, uint32 len)
: value_(str, len) {
+ GetOrCreateVarID();
dmichael (off chromium) 2011/12/12 18:28:50 I think we shouldn't have this ref-count here. If
}
StringVar::~StringVar() {
+ VarTracker* tracker = PpapiGlobals::Get()->GetVarTracker();
+ tracker->ReleaseVar(GetExistingVarID());
}
StringVar* StringVar::AsStringVar() {
@@ -113,7 +117,7 @@ StringVar* StringVar::AsStringVar() {
}
PP_Var StringVar::GetPPVar() {
- int32 id = GetOrCreateVarID();
+ int32 id = GetExistingVarID();
if (!id)
return PP_MakeNull();
@@ -153,4 +157,3 @@ StringVar* StringVar::FromPPVar(PP_Var var) {
}
} // namespace ppapi
-
« no previous file with comments | « no previous file | ppapi/tests/test_case.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698