remove unused parameter (that also slowed us down) to SkAutoTDelete

git-svn-id: http://skia.googlecode.com/svn/trunk@5611 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-09-20 18:04:12 +00:00
Родитель cc9471c36d
Коммит 52657c75b5
1 изменённых файлов: 24 добавлений и 8 удалений

Просмотреть файл

@ -76,18 +76,34 @@ private:
// See also SkTScopedPtr.
template <typename T> class SkAutoTDelete : SkNoncopyable {
public:
SkAutoTDelete(T* obj, bool deleteWhenDone = true) : fObj(obj) {
fDeleteWhenDone = deleteWhenDone;
}
~SkAutoTDelete() { if (fDeleteWhenDone) delete fObj; }
SkAutoTDelete(T* obj) : fObj(obj) {}
~SkAutoTDelete() { delete fObj; }
T* get() const { return fObj; }
void free() { delete fObj; fObj = NULL; }
T* detach() { T* obj = fObj; fObj = NULL; return obj; }
T* get() const { return fObj; }
T& operator*() const { SkASSERT(fObj); return *fObj; }
T* operator->() const { SkASSERT(fObj); return fObj; }
/**
* Delete the owned object, setting the internal pointer to NULL.
*/
void free() {
delete fObj;
fObj = NULL;
}
/**
* Transfer ownership of the object to the caller, setting the internal
* pointer to NULL. Note that this differs from get(), which also returns
* the pointer, but it does not transfer ownership.
*/
T* detach() {
T* obj = fObj;
fObj = NULL;
return obj;
}
private:
T* fObj;
bool fDeleteWhenDone;
};
template <typename T> class SkAutoTDeleteArray : SkNoncopyable {