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

Unified Diff: include/core/SkTemplates.h

Issue 396143004: Add a working SkFontMgr_fontconfig. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove T& operator* from SkAutoTCallVProc. Created 6 years, 4 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: include/core/SkTemplates.h
diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h
index 5d3fa2d10cd2371c7dcebf2b45552e8922412884..434fcb8c0ea1111a748bfb59edd18aa6e317cce0 100644
--- a/include/core/SkTemplates.h
+++ b/include/core/SkTemplates.h
@@ -77,7 +77,19 @@ template <typename T, void (*P)(T*)> class SkAutoTCallVProc : SkNoncopyable {
public:
SkAutoTCallVProc(T* obj): fObj(obj) {}
~SkAutoTCallVProc() { if (fObj) P(fObj); }
+
+ operator T*() const { return fObj; }
+ T* operator->() const { SkASSERT(fObj); return fObj; }
+
T* detach() { T* obj = fObj; fObj = NULL; return obj; }
+ void reset(T* obj = NULL) {
+ if (fObj != obj) {
+ if (fObj) {
+ P(fObj);
+ }
+ fObj = obj;
+ }
+ }
private:
T* fObj;
};

Powered by Google App Engine
This is Rietveld 408576698