aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-03-16 13:53:35 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-16 13:53:35 -0700
commit18300a3aa7cb6eb55d21bb0450dffa58b6fc062c (patch)
treed1c0f54567937ed7dd44fb17842c6c1b544815d0 /include
parent830dfd87a7707f687e13da5be645e75c746a2cf5 (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/core/SkRefCnt.h1
-rw-r--r--include/core/SkTypes.h8
-rw-r--r--include/private/SkTDArray.h2
-rw-r--r--include/private/SkTemplates.h10
-rw-r--r--include/views/SkOSWindow_Android.h2
-rw-r--r--include/views/SkOSWindow_Mac.h2
-rw-r--r--include/views/SkOSWindow_SDL.h2
-rw-r--r--include/views/SkOSWindow_Unix.h2
-rw-r--r--include/views/SkOSWindow_Win.h2
-rw-r--r--include/views/SkOSWindow_iOS.h2
10 files changed, 14 insertions, 19 deletions
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index d18a63a49f..98e521f6ea 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -194,7 +194,6 @@ template <typename T> class SkAutoTUnref : public std::unique_ptr<T, SkTUnref<T>
public:
explicit SkAutoTUnref(T* obj = nullptr) : std::unique_ptr<T, SkTUnref<T>>(obj) {}
- T* detach() { return this->release(); }
operator T*() const { return this->get(); }
// Android's std::unique_ptr's operator bool() is sometimes not explicit...
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index b9e5191955..27280d4283 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -514,10 +514,10 @@ public:
internal reference to null. Note the caller is reponsible for calling
sk_free on the returned address.
*/
- void* detach() { return this->set(NULL); }
+ void* release() { return this->set(NULL); }
/** Free the current buffer, and set the internal reference to NULL. Same
- as calling sk_free(detach())
+ as calling sk_free(release())
*/
void free() {
sk_free(fPtr);
@@ -535,7 +535,7 @@ private:
/**
* Manage an allocated block of heap memory. This object is the sole manager of
* the lifetime of the block, so the caller must not call sk_free() or delete
- * on the block, unless detach() was called.
+ * on the block, unless release() was called.
*/
class SkAutoMalloc : SkNoncopyable {
public:
@@ -606,7 +606,7 @@ public:
internal reference to null. Note the caller is reponsible for calling
sk_free on the returned address.
*/
- void* detach() {
+ void* release() {
void* ptr = fPtr;
fPtr = NULL;
fSize = 0;
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index b5332a2cc4..8af54bbcc5 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -70,7 +70,7 @@ public:
/** 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 811b817d22..526c307558 100644
--- a/include/private/SkTemplates.h
+++ b/include/private/SkTemplates.h
@@ -53,7 +53,7 @@ template <typename R, typename T, R (*P)(T*)> struct SkFunctionWrapper {
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
* 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;
diff --git a/include/views/SkOSWindow_Android.h b/include/views/SkOSWindow_Android.h
index 4fc32ce19d..74175bafd1 100644
--- a/include/views/SkOSWindow_Android.h
+++ b/include/views/SkOSWindow_Android.h
@@ -29,7 +29,7 @@ public:
};
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo* info);
- void detach();
+ void release();
void present();
bool makeFullscreen() { return true; }
void closeWindow();
diff --git a/include/views/SkOSWindow_Mac.h b/include/views/SkOSWindow_Mac.h
index 6ce898321f..efa97bf872 100644
--- a/include/views/SkOSWindow_Mac.h
+++ b/include/views/SkOSWindow_Mac.h
@@ -32,7 +32,7 @@ public:
#endif // SK_COMMAND_BUFFER
};
- void detach();
+ void release();
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
void present();
diff --git a/include/views/SkOSWindow_SDL.h b/include/views/SkOSWindow_SDL.h
index e08108add4..6823441715 100644
--- a/include/views/SkOSWindow_SDL.h
+++ b/include/views/SkOSWindow_SDL.h
@@ -28,7 +28,7 @@ public:
#endif // SK_COMMAND_BUFFER
};
- void detach();
+ void release();
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
void present();
bool makeFullscreen();
diff --git a/include/views/SkOSWindow_Unix.h b/include/views/SkOSWindow_Unix.h
index ecd0a14521..30386da183 100644
--- a/include/views/SkOSWindow_Unix.h
+++ b/include/views/SkOSWindow_Unix.h
@@ -45,7 +45,7 @@ public:
};
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
- void detach();
+ void release();
void present();
int getMSAASampleCount() const { return fMSAASampleCount; }
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
index c1a68c621e..a1b222d7a1 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -48,7 +48,7 @@ public:
};
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
- void detach();
+ void release();
void present();
bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
diff --git a/include/views/SkOSWindow_iOS.h b/include/views/SkOSWindow_iOS.h
index 071d6db18c..5a8b2e3d2f 100644
--- a/include/views/SkOSWindow_iOS.h
+++ b/include/views/SkOSWindow_iOS.h
@@ -21,7 +21,7 @@ public:
kNativeGL_BackEndType,
};
- void detach();
+ void release();
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
void present();