summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/shared_impl/var.h6
-rw-r--r--ppapi/shared_impl/var_tracker.cc1
2 files changed, 7 insertions, 0 deletions
diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h
index 988898a0..49b9272 100644
--- a/ppapi/shared_impl/var.h
+++ b/ppapi/shared_impl/var.h
@@ -17,6 +17,7 @@ namespace ppapi {
class NPObjectVar;
class ProxyObjectVar;
class StringVar;
+class VarTracker;
// Var -------------------------------------------------------------------------
@@ -48,6 +49,8 @@ class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> {
int32 GetExistingVarID() const;
protected:
+ friend class VarTracker;
+
Var();
// Returns the unique ID associated with this string or object, creating it
@@ -62,6 +65,9 @@ class PPAPI_SHARED_EXPORT Var : public base::RefCounted<Var> {
// before. This is used in cases where the ID is generated externally.
void AssignVarID(int32 id);
+ // Reset the assigned object ID.
+ void ResetVarID() { var_id_ = 0; }
+
private:
// This will be 0 if no ID has been assigned (this happens lazily).
int32 var_id_;
diff --git a/ppapi/shared_impl/var_tracker.cc b/ppapi/shared_impl/var_tracker.cc
index 7f7157e..d95a759 100644
--- a/ppapi/shared_impl/var_tracker.cc
+++ b/ppapi/shared_impl/var_tracker.cc
@@ -100,6 +100,7 @@ bool VarTracker::ReleaseVar(int32 var_id) {
} else {
// All other var types can just be released.
DCHECK(info.track_with_no_reference_count == 0);
+ info.var->ResetVarID();
live_vars_.erase(found);
}
}