SkTInternalLList: remove SkPtrWrapper, SkNoncopyable
Change-Id: I24fb1c38eb4cd9ec27b81a4e0010b1268442a29f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210063
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/include/private/SkTInternalLList.h b/include/private/SkTInternalLList.h
index 547befe..dbba5cc 100644
--- a/include/private/SkTInternalLList.h
+++ b/include/private/SkTInternalLList.h
@@ -8,43 +8,25 @@
#ifndef SkTInternalLList_DEFINED
#define SkTInternalLList_DEFINED
-#include "../private/SkNoncopyable.h"
#include "SkTypes.h"
/**
- * Helper class to automatically initialize the doubly linked list created pointers.
- */
-template <typename T> class SkPtrWrapper {
- public:
- SkPtrWrapper() : fPtr(nullptr) {}
- SkPtrWrapper& operator =(T* ptr) { fPtr = ptr; return *this; }
- operator T*() const { return fPtr; }
- T* operator->() { return fPtr; }
- private:
- T* fPtr;
-};
-
-
-/**
* This macro creates the member variables required by the SkTInternalLList class. It should be
* placed in the private section of any class that will be stored in a double linked list.
*/
#define SK_DECLARE_INTERNAL_LLIST_INTERFACE(ClassName) \
friend class SkTInternalLList<ClassName>; \
/* back pointer to the owning list - for debugging */ \
- SkDEBUGCODE(SkPtrWrapper<SkTInternalLList<ClassName> > fList;) \
- SkPtrWrapper<ClassName> fPrev; \
- SkPtrWrapper<ClassName> fNext
+ SkDEBUGCODE(SkTInternalLList<ClassName>* fList = nullptr;) \
+ ClassName* fPrev = nullptr; \
+ ClassName* fNext = nullptr
/**
* This class implements a templated internal doubly linked list data structure.
*/
-template <class T> class SkTInternalLList : SkNoncopyable {
+template <class T> class SkTInternalLList {
public:
- SkTInternalLList()
- : fHead(nullptr)
- , fTail(nullptr) {
- }
+ SkTInternalLList() {}
void reset() {
fHead = nullptr;
@@ -310,10 +292,11 @@
#endif // SK_DEBUG
private:
- T* fHead;
- T* fTail;
+ T* fHead = nullptr;
+ T* fTail = nullptr;
- typedef SkNoncopyable INHERITED;
+ SkTInternalLList(const SkTInternalLList&) = delete;
+ SkTInternalLList& operator=(const SkTInternalLList&) = delete;
};
#endif
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index 8680ea2..5d6ea3e 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -28,7 +28,7 @@
allocCnt is the number of objects to allocate as a group. In the worst case fragmentation
each object is using the space required for allocCnt unfragmented objects.
*/
-template <typename T, unsigned int N> class SkTLList : SkNoncopyable {
+template <typename T, unsigned int N> class SkTLList {
private:
struct Block;
struct Node {
@@ -346,6 +346,9 @@
NodeList fFreeList;
Block fFirstBlock;
int fCount;
+
+ SkTLList(const SkTLList&) = delete;
+ SkTLList& operator=(const SkTLList&) = delete;
};
#endif