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

Unified Diff: ppapi/cpp/var.h

Issue 10905128: Pepper WebSocket API: Fix memory leak issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no leak! Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/private/var_private.cc ('k') | ppapi/cpp/var.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/var.h
diff --git a/ppapi/cpp/var.h b/ppapi/cpp/var.h
index b0914be3de7f473c81cf76571ab9edce6d9f199e..437eed95f9c35d48e4b12f4b950e1387f0a90511 100644
--- a/ppapi/cpp/var.h
+++ b/ppapi/cpp/var.h
@@ -57,7 +57,7 @@ class Var {
/// the reference count will not normally be incremented for you.
Var(PassRef, PP_Var var) {
var_ = var;
- needs_release_ = true;
+ is_managed_ = true;
}
struct DontManage {};
@@ -72,7 +72,7 @@ class Var {
/// @param[in] var A <code>Var</code>.
Var(DontManage, PP_Var var) {
var_ = var;
- needs_release_ = false;
+ is_managed_ = false;
}
/// A constructor for copying a <code>Var</code>.
@@ -211,7 +211,7 @@ class Var {
PP_Var Detach() {
PP_Var ret = var_;
var_ = PP_MakeUndefined();
- needs_release_ = false;
+ is_managed_ = true;
return ret;
}
@@ -280,7 +280,10 @@ class Var {
protected:
PP_Var var_;
- bool needs_release_;
+
+ // |is_managed_| indicates if the instance manages |var_|.
+ // You need to check if |var_| is refcounted to call Release().
+ bool is_managed_;
private:
// Prevent an arbitrary pointer argument from being implicitly converted to
« no previous file with comments | « ppapi/cpp/private/var_private.cc ('k') | ppapi/cpp/var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698