sk_make_sp<T>()

because
    auto atm = sk_make_sp<SkAdvancedTypefaceMetrics>();
is better than
    sk_sp<SkAdvancedTypefaceMetrics> atm(new SkAdvancedTypefaceMetrics);

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753973002

Review URL: https://codereview.chromium.org/1753973002
This commit is contained in:
halcanary 2016-03-02 08:06:20 -08:00 committed by Commit bot
parent 7349490991
commit 217c0b3f13
2 changed files with 7 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include "../private/SkAtomics.h"
#include "../private/SkUniquePtr.h"
#include "SkTypes.h"
#include <utility>
/** \class SkRefCntBase
@ -326,4 +327,9 @@ private:
T* fPtr;
};
template <typename T, typename... Args>
sk_sp<T> sk_make_sp(Args&&... args) {
return sk_sp<T>(new T(std::forward<Args>(args)...));
}
#endif

View File

@ -120,7 +120,7 @@ public:
};
static sk_sp<Effect> Create() {
return sk_sp<Effect>(new Effect);
return sk_make_sp<Effect>();
}
class Paint {