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

Unified Diff: src/core/SkAdvancedTypefaceMetrics.h

Issue 1785353002: Revert of Use std::unique_ptr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « include/private/SkUniquePtr.h ('k') | src/core/SkAdvancedTypefaceMetrics.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkAdvancedTypefaceMetrics.h
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 5a2180fade0364d2899bf35bbb428f71fe0259fd..b2c9ac3142d0df2fe4995b0084af2f4a6dfdccb9 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -15,35 +15,6 @@
#include "SkString.h"
#include "SkTDArray.h"
#include "SkTemplates.h"
-
-// Whatever std::unique_ptr Clank's using doesn't seem to work with AdvanceMetric's
-// style of forward-declaration. Probably just a bug in an old libc++ / libstdc++.
-// For now, hack around it with our own smart pointer. It'd be nice to clean up.
-template <typename T>
-class SkHackyAutoTDelete : SkNoncopyable {
-public:
- explicit SkHackyAutoTDelete(T* ptr = nullptr) : fPtr(ptr) {}
- ~SkHackyAutoTDelete() { delete fPtr; }
-
- T* get() const { return fPtr; }
- T* operator->() const { return fPtr; }
-
- void reset(T* ptr) {
- if (ptr != fPtr) {
- delete fPtr;
- fPtr = ptr;
- }
- }
- void free() { this->reset(nullptr); }
- T* detach() {
- T* ptr = fPtr;
- fPtr = nullptr;
- return ptr;
- }
-
-private:
- T* fPtr;
-};
/** \class SkAdvancedTypefaceMetrics
@@ -126,7 +97,7 @@
uint16_t fStartId;
uint16_t fEndId;
SkTDArray<Data> fAdvance;
- SkHackyAutoTDelete<AdvanceMetric<Data> > fNext;
+ SkAutoTDelete<AdvanceMetric<Data> > fNext;
};
struct VerticalMetric {
@@ -159,9 +130,9 @@
void resetRange(SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* range,
int startId);
-template <typename Data, template<typename> class AutoTDelete>
+template <typename Data>
SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* appendRange(
- AutoTDelete<SkAdvancedTypefaceMetrics::AdvanceMetric<Data> >* nextSlot,
+ SkAutoTDelete<SkAdvancedTypefaceMetrics::AdvanceMetric<Data> >* nextSlot,
int startId);
template <typename Data>
« no previous file with comments | « include/private/SkUniquePtr.h ('k') | src/core/SkAdvancedTypefaceMetrics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698