detach -> release
The C++ standard library uses the name "release" for the operation we call "detach".
Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete).
This was a fairly blind transformation. There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release".
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002
Review URL: https://codereview.chromium.org/1809733002
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index b5332a2..8af54bb 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -70,7 +70,7 @@
/** Return a ptr to the array of data, to be freed with sk_free. This also
resets the SkTDArray to be empty.
*/
- T* detach() {
+ T* release() {
T* array = fArray;
fArray = NULL;
fReserve = fCount = 0;
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h
index 811b817..526c307 100644
--- a/include/private/SkTemplates.h
+++ b/include/private/SkTemplates.h
@@ -53,7 +53,7 @@
Call a function when this goes out of scope. The template uses two
parameters, the object, and a function that is to be called in the destructor.
- If detach() is called, the object reference is set to null. If the object
+ If release() is called, the object reference is set to null. If the object
reference is null when the destructor is called, we do not call the
function.
*/
@@ -63,14 +63,13 @@
SkAutoTCallVProc(T* obj): std::unique_ptr<T, SkFunctionWrapper<void, T, P>>(obj) {}
operator T*() const { return this->get(); }
- T* detach() { return this->release(); }
};
/** \class SkAutoTCallIProc
Call a function when this goes out of scope. The template uses two
parameters, the object, and a function that is to be called in the destructor.
-If detach() is called, the object reference is set to null. If the object
+If release() is called, the object reference is set to null. If the object
reference is null when the destructor is called, we do not call the
function.
*/
@@ -80,7 +79,6 @@
SkAutoTCallIProc(T* obj): std::unique_ptr<T, SkFunctionWrapper<int, T, P>>(obj) {}
operator T*() const { return this->get(); }
- T* detach() { return this->release(); }
};
/** \class SkAutoTDelete
@@ -99,7 +97,6 @@
operator T*() const { return this->get(); }
void free() { this->reset(nullptr); }
- T* detach() { return this->release(); }
// See SkAutoTUnref for why we do this.
explicit operator bool() const { return this->get() != nullptr; }
@@ -110,7 +107,6 @@
SkAutoTDeleteArray(T array[]) : std::unique_ptr<T[]>(array) {}
void free() { this->reset(nullptr); }
- T* detach() { return this->release(); }
};
/** Allocate an array of T elements, and free the array in the destructor
@@ -321,7 +317,7 @@
* pointer to NULL. Note that this differs from get(), which also returns
* the pointer, but it does not transfer ownership.
*/
- T* detach() {
+ T* release() {
T* ptr = fPtr;
fPtr = NULL;
return ptr;