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

Unified Diff: include/core/SkRefCnt.h

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 years, 1 month 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 | « include/core/SkPicture.h ('k') | include/core/SkString.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRefCnt.h
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 99df0c12567c4954c39243b6526e643d8605fe6f..b010faf7601af19576157d89a0a4161653d43603 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -237,11 +237,13 @@ public:
private:
T* fObj;
};
+// Can't use the #define trick below to guard a bare SkAutoTUnref(...) because it's templated. :(
class SkAutoUnref : public SkAutoTUnref<SkRefCnt> {
public:
SkAutoUnref(SkRefCnt* obj) : SkAutoTUnref<SkRefCnt>(obj) {}
};
+#define SkAutoUnref(...) SK_REQUIRE_LOCAL_VAR(SkAutoUnref)
class SkAutoRef : SkNoncopyable {
public:
@@ -250,6 +252,7 @@ public:
private:
SkRefCnt* fObj;
};
+#define SkAutoRef(...) SK_REQUIRE_LOCAL_VAR(SkAutoRef)
/** Wrapper class for SkRefCnt pointers. This manages ref/unref of a pointer to
a SkRefCnt (or subclass) object.
« no previous file with comments | « include/core/SkPicture.h ('k') | include/core/SkString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698