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

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: rebase 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
Index: ppapi/cpp/var.h
diff --git a/ppapi/cpp/var.h b/ppapi/cpp/var.h
index b0914be3de7f473c81cf76571ab9edce6d9f199e..b44e46aa3dcc23c94437824b5068d38f14b68d01 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;
+ needs_management_ = 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;
+ needs_management_ = 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;
+ needs_management_ = true;
return ret;
}
@@ -280,7 +280,10 @@ class Var {
protected:
PP_Var var_;
- bool needs_release_;
+
+ // |needs_management_| indicates if the instance manages |var_|.
+ // You need to check if |var_| is refcounted to call Release().
+ bool needs_management_;
dmichael (off chromium) 2012/09/10 16:21:14 Good idea on the rename. How about is_managed_? A
Takashi Toyoshima 2012/09/11 08:38:15 Agreed.
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') | ppapi/cpp/var.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698