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/bench/nanobench.cpp b/bench/nanobench.cpp
index dd792dd..88dd74f 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -647,7 +647,7 @@
}
} while(SkCommandLineFlags::ShouldSkip(FLAGS_sourceType, fSourceType) ||
SkCommandLineFlags::ShouldSkip(FLAGS_benchType, fBenchType));
- return bench.detach();
+ return bench.release();
}
Benchmark* rawNext() {
@@ -665,7 +665,7 @@
if (gm->runAsBench()) {
fSourceType = "gm";
fBenchType = "micro";
- return new GMBench(gm.detach());
+ return new GMBench(gm.release());
}
}
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 6748544..d8421c9 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -315,7 +315,7 @@
FLAGS_src.contains(tag) &&
!SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) {
TaggedSrc& s = gSrcs.push_back();
- s.reset(src.detach());
+ s.reset(src.release());
s.tag = tag;
s.options = options;
}
@@ -791,7 +791,7 @@
}
TaggedSink& ts = gSinks.push_back();
- ts.reset(sink.detach());
+ ts.reset(sink.release());
ts.tag = config.getTag();
}
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 134c7a3..27cb6aa 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -818,7 +818,7 @@
// We have disabled these tests in DM.cpp.
SkASSERT(kGray_8_SkColorType != gen->getInfo().colorType());
- SkAutoTDelete<SkImage> image(SkImage::NewFromGenerator(gen.detach(), nullptr));
+ SkAutoTDelete<SkImage> image(SkImage::NewFromGenerator(gen.release(), nullptr));
if (!image) {
return "Could not create image from codec image generator.";
}
diff --git a/example/HelloWorld.cpp b/example/HelloWorld.cpp
index e30c467..817bbaa 100644
--- a/example/HelloWorld.cpp
+++ b/example/HelloWorld.cpp
@@ -49,7 +49,7 @@
SkSafeUnref(fRenderTarget);
fRenderTarget = NULL;
- INHERITED::detach();
+ INHERITED::release();
}
void HelloWorldWindow::setTitle() {
@@ -65,7 +65,7 @@
bool result = attach(kNativeGL_BackEndType, 0 /*msaa*/, &fAttachmentInfo);
if (false == result) {
SkDebugf("Not possible to create backend.\n");
- detach();
+ release();
return false;
}
diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm
index 0c5209f..bd6d533 100644
--- a/experimental/iOSSampleApp/SkSampleUIView.mm
+++ b/experimental/iOSSampleApp/SkSampleUIView.mm
@@ -97,7 +97,7 @@
SkSafeUnref(fCurContext);
SkSafeUnref(fCurIntf);
SkDebugf("Failed to setup 3D");
- win->detach();
+ win->release();
}
#endif // SK_SUPPORT_GPU
// call windowSizeChanged to create the render target
@@ -115,7 +115,7 @@
SkSafeUnref(fCurRenderTarget);
fCurRenderTarget = NULL;
#endif
- win->detach();
+ win->release();
fBackend = SampleWindow::kNone_BackEndType;
}
diff --git a/experimental/tools/coreGraphicsPdf2png.cpp b/experimental/tools/coreGraphicsPdf2png.cpp
index 98c5b28..d02e3de 100644
--- a/experimental/tools/coreGraphicsPdf2png.cpp
+++ b/experimental/tools/coreGraphicsPdf2png.cpp
@@ -49,7 +49,7 @@
SkBitmap bm;
SkAutoTDelete<SkStream> in(open_for_reading(argc > 1 ? argv[1] : NULL));
SkAutoTDelete<SkWStream> out(open_for_writing(argc > 2 ? argv[2] : NULL));
- if (SkPDFDocumentToBitmap(in.detach(), &bm) && to_png(out, bm)) {
+ if (SkPDFDocumentToBitmap(in.release(), &bm) && to_png(out, bm)) {
return 0;
} else {
return 1;
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index d18a63a..98e521f 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -194,7 +194,6 @@
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 b9e5191..27280d4 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -514,10 +514,10 @@
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 @@
/**
* 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 @@
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 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;
diff --git a/include/views/SkOSWindow_Android.h b/include/views/SkOSWindow_Android.h
index 4fc32ce..74175ba 100644
--- a/include/views/SkOSWindow_Android.h
+++ b/include/views/SkOSWindow_Android.h
@@ -29,7 +29,7 @@
};
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 6ce8983..efa97bf 100644
--- a/include/views/SkOSWindow_Mac.h
+++ b/include/views/SkOSWindow_Mac.h
@@ -32,7 +32,7 @@
#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 e08108a..6823441 100644
--- a/include/views/SkOSWindow_SDL.h
+++ b/include/views/SkOSWindow_SDL.h
@@ -28,7 +28,7 @@
#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 ecd0a14..30386da 100644
--- a/include/views/SkOSWindow_Unix.h
+++ b/include/views/SkOSWindow_Unix.h
@@ -45,7 +45,7 @@
};
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 c1a68c6..a1b222d 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -48,7 +48,7 @@
};
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 071d6db..5a8b2e3 100644
--- a/include/views/SkOSWindow_iOS.h
+++ b/include/views/SkOSWindow_iOS.h
@@ -21,7 +21,7 @@
kNativeGL_BackEndType,
};
- void detach();
+ void release();
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
void present();
diff --git a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
index 7da4fa8..2ae7223 100644
--- a/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
+++ b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp
@@ -79,7 +79,7 @@
return true;
}
-void SkOSWindow::detach() {
+void SkOSWindow::release() {
}
void SkOSWindow::present() {
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
index 76ace6d..644191d 100644
--- a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
+++ b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
@@ -18,7 +18,7 @@
}
SkOSWindow::~SkOSWindow() {
- this->detach();
+ this->release();
}
bool SkOSWindow::attach(SkBackEndTypes attachType,
@@ -149,7 +149,7 @@
}
}
-void SkOSWindow::detach() {
+void SkOSWindow::release() {
if (fWindow.fDisplay != EGL_NO_DISPLAY) {
eglMakeCurrent(fWindow.fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (fWindow.fContext != EGL_NO_CONTEXT) {
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 6d5f647..7212223 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -261,7 +261,7 @@
fCurIntf = nullptr;
SkDebugf("Failed to setup 3D");
- win->detach();
+ win->release();
}
#endif // SK_SUPPORT_GPU
// call windowSizeChanged to create the render target
@@ -283,7 +283,7 @@
SkSafeUnref(fCurRenderTarget);
fCurRenderTarget = nullptr;
#endif
- win->detach();
+ win->release();
fBackend = kNone_BackEndType;
}
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index 43e7cf4..9203cba 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -191,7 +191,7 @@
switch (bbox) {
case kNo_BBoxType:
// no bbox playback necessary
- return pic.detach();
+ return pic.release();
case kRTree_BBoxType:
factory.reset(new SkRTreeFactory);
break;
diff --git a/src/android/SkBitmapRegionDecoder.cpp b/src/android/SkBitmapRegionDecoder.cpp
index a153282..712034b 100644
--- a/src/android/SkBitmapRegionDecoder.cpp
+++ b/src/android/SkBitmapRegionDecoder.cpp
@@ -24,7 +24,7 @@
SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
switch (strategy) {
case kCanvas_Strategy: {
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(streamDeleter.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(streamDeleter.release()));
if (nullptr == codec) {
SkCodecPrintf("Error: Failed to create decoder.\n");
return nullptr;
@@ -47,11 +47,11 @@
SkASSERT(SkCodec::kTopDown_SkScanlineOrder == codec->getScanlineOrder() ||
SkCodec::kNone_SkScanlineOrder == codec->getScanlineOrder());
- return new SkBitmapRegionCanvas(codec.detach());
+ return new SkBitmapRegionCanvas(codec.release());
}
case kAndroidCodec_Strategy: {
SkAutoTDelete<SkAndroidCodec> codec =
- SkAndroidCodec::NewFromStream(streamDeleter.detach());
+ SkAndroidCodec::NewFromStream(streamDeleter.release());
if (nullptr == codec) {
SkCodecPrintf("Error: Failed to create codec.\n");
return NULL;
@@ -67,7 +67,7 @@
return nullptr;
}
- return new SkBitmapRegionCodec(codec.detach());
+ return new SkBitmapRegionCodec(codec.release());
}
default:
SkASSERT(false);
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 6c3efe0..6db0991 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -41,14 +41,14 @@
#endif
case kBMP_SkEncodedFormat:
case kWBMP_SkEncodedFormat:
- return new SkSampledCodec(codec.detach());
+ return new SkSampledCodec(codec.release());
#ifdef SK_CODEC_DECODES_WEBP
case kWEBP_SkEncodedFormat:
- return new SkWebpAdapterCodec((SkWebpCodec*) codec.detach());
+ return new SkWebpAdapterCodec((SkWebpCodec*) codec.release());
#endif
#ifdef SK_CODEC_DECODES_RAW
case kDNG_SkEncodedFormat:
- return new SkRawAdapterCodec((SkRawCodec*)codec.detach());
+ return new SkRawAdapterCodec((SkRawCodec*)codec.release());
#endif
default:
return nullptr;
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index 5616a65..32f1d15 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -509,7 +509,7 @@
return false;
}
- *codecOut = new SkBmpMaskCodec(imageInfo, stream, bitsPerPixel, masks.detach(),
+ *codecOut = new SkBmpMaskCodec(imageInfo, stream, bitsPerPixel, masks.release(),
rowOrder);
return true;
case kRLE_BmpInputFormat:
@@ -541,7 +541,7 @@
// codec has taken ownership of stream, so we do not need to
// delete it.
SkASSERT(codec);
- streamDeleter.detach();
+ streamDeleter.release();
return codec;
}
return nullptr;
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index c8de73c..fc57e94 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -88,19 +88,19 @@
// But this code follows the same pattern as the loop.
#ifdef SK_CODEC_DECODES_PNG
if (SkPngCodec::IsPng(buffer, bytesRead)) {
- return SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReader);
+ return SkPngCodec::NewFromStream(streamDeleter.release(), chunkReader);
} else
#endif
{
for (DecoderProc proc : gDecoderProcs) {
if (proc.IsFormat(buffer, bytesRead)) {
- return proc.NewFromStream(streamDeleter.detach());
+ return proc.NewFromStream(streamDeleter.release());
}
}
#ifdef SK_CODEC_DECODES_RAW
// Try to treat the input as RAW if all the other checks failed.
- return SkRawCodec::NewFromStream(streamDeleter.detach());
+ return SkRawCodec::NewFromStream(streamDeleter.release());
#endif
}
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 56d20e9..2233c66 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -216,12 +216,12 @@
// the default.
SkImageInfo imageInfo = SkImageInfo::Make(size.width(), size.height(), kIndex_8_SkColorType,
alphaType);
- *codecOut = new SkGifCodec(imageInfo, streamDeleter.detach(), gif.detach(), transIndex,
+ *codecOut = new SkGifCodec(imageInfo, streamDeleter.release(), gif.release(), transIndex,
frameRect, frameIsSubset);
} else {
SkASSERT(nullptr != gifOut);
- streamDeleter.detach();
- *gifOut = gif.detach();
+ streamDeleter.release();
+ *gifOut = gif.release();
}
return true;
}
diff --git a/src/codec/SkIcoCodec.cpp b/src/codec/SkIcoCodec.cpp
index dc4222a..d74c150 100644
--- a/src/codec/SkIcoCodec.cpp
+++ b/src/codec/SkIcoCodec.cpp
@@ -140,9 +140,9 @@
// Check if the embedded codec is bmp or png and create the codec
SkCodec* codec = nullptr;
if (SkPngCodec::IsPng((const char*) data->bytes(), data->size())) {
- codec = SkPngCodec::NewFromStream(embeddedStream.detach());
+ codec = SkPngCodec::NewFromStream(embeddedStream.release());
} else {
- codec = SkBmpCodec::NewFromIco(embeddedStream.detach());
+ codec = SkBmpCodec::NewFromIco(embeddedStream.release());
}
// Save a valid codec
@@ -172,7 +172,7 @@
// Note that stream is owned by the embedded codec, the ico does not need
// direct access to the stream.
- return new SkIcoCodec(info, codecs.detach());
+ return new SkIcoCodec(info, codecs.release());
}
/*
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index f1b55df..2534a5f 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -55,10 +55,10 @@
// Create image info object and the codec
const SkImageInfo& imageInfo = SkImageInfo::Make(decoderMgr->dinfo()->image_width,
decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaType);
- *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.detach());
+ *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.release());
} else {
SkASSERT(nullptr != decoderMgrOut);
- *decoderMgrOut = decoderMgr.detach();
+ *decoderMgrOut = decoderMgr.release();
}
return true;
}
@@ -69,7 +69,7 @@
if (ReadHeader(stream, &codec, nullptr)) {
// Codec has taken ownership of the stream, we do not need to delete it
SkASSERT(codec);
- streamDeleter.detach();
+ streamDeleter.release();
return codec;
}
return nullptr;
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 317defb..326b9c2 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -75,7 +75,7 @@
fInfo_ptr = info_ptr;
}
- void detach() {
+ void release() {
fPng_ptr = nullptr;
fInfo_ptr = nullptr;
}
@@ -414,7 +414,7 @@
if (imageInfo) {
*imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaType, profileType);
}
- autoClean.detach();
+ autoClean.release();
if (png_ptrp) {
*png_ptrp = png_ptr;
}
@@ -841,11 +841,11 @@
auto colorSpace = read_color_space(png_ptr, info_ptr);
if (1 == numberPasses) {
- return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader,
+ return new SkPngScanlineDecoder(imageInfo, streamDeleter.release(), chunkReader,
png_ptr, info_ptr, bitDepth, colorSpace);
}
- return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader,
+ return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.release(), chunkReader,
png_ptr, info_ptr, bitDepth, numberPasses,
colorSpace);
}
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index 706d5dd..90ee322 100644
--- a/src/codec/SkWbmpCodec.cpp
+++ b/src/codec/SkWbmpCodec.cpp
@@ -168,7 +168,7 @@
}
SkImageInfo info = SkImageInfo::Make(size.width(), size.height(),
kGray_8_SkColorType, kOpaque_SkAlphaType);
- return new SkWbmpCodec(info, streamDeleter.detach());
+ return new SkWbmpCodec(info, streamDeleter.release());
}
int SkWbmpCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 6cfb385..a795fdd 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -77,7 +77,7 @@
SkAutoTDelete<SkStream> streamDeleter(stream);
SkImageInfo info;
if (webp_parse_header(stream, &info)) {
- return new SkWebpCodec(info, streamDeleter.detach());
+ return new SkWebpCodec(info, streamDeleter.release());
}
return nullptr;
}
diff --git a/src/core/SkAdvancedTypefaceMetrics.cpp b/src/core/SkAdvancedTypefaceMetrics.cpp
index 406a759..b5b49e3 100644
--- a/src/core/SkAdvancedTypefaceMetrics.cpp
+++ b/src/core/SkAdvancedTypefaceMetrics.cpp
@@ -250,7 +250,7 @@
finishRange(curRange, lastIndex - 1,
SkAdvancedTypefaceMetrics::WidthRange::kRange);
}
- return result.detach();
+ return result.release();
}
// Make AdvanceMetric template functions available for linking with typename
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 5a2180f..92655d2 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -35,7 +35,7 @@
}
}
void free() { this->reset(nullptr); }
- T* detach() {
+ T* release() {
T* ptr = fPtr;
fPtr = nullptr;
return ptr;
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 8e889d4..d11ef78 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -107,6 +107,6 @@
return nullptr;
}
- return new SkColorTable(colors.detach(), count, kAllocatedWithMalloc);
+ return new SkColorTable(colors.release(), count, kAllocatedWithMalloc);
}
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h
index 095ecce..cfdc571 100644
--- a/src/core/SkFontDescriptor.h
+++ b/src/core/SkFontDescriptor.h
@@ -34,7 +34,7 @@
}
bool hasStream() const { return fStream.get() != nullptr; }
SkStreamAsset* duplicateStream() const { return fStream->duplicate(); }
- SkStreamAsset* detachStream() { return fStream.detach(); }
+ SkStreamAsset* detachStream() { return fStream.release(); }
SkStreamAsset* getStream() { return fStream.get(); }
int getIndex() const { return fIndex; }
int getAxisCount() const { return fAxisCount; }
@@ -62,7 +62,7 @@
const char* getFullName() const { return fFullName.c_str(); }
const char* getPostscriptName() const { return fPostscriptName.c_str(); }
bool hasFontData() const { return fFontData.get() != nullptr; }
- SkFontData* detachFontData() { return fFontData.detach(); }
+ SkFontData* detachFontData() { return fFontData.release(); }
void setFamilyName(const char* name) { fFamilyName.set(name); }
void setFullName(const char* name) { fFullName.set(name); }
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index e9b7f6a..12c09cb 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -55,7 +55,7 @@
// Now that we know we can hand-off the generator (to be owned by the cacherator) we can
// release our holder. (we DONT want to delete it here anymore)
- genHolder.detach();
+ genHolder.release();
return new SkImageCacherator(gen, gen->getInfo().makeWH(subset->width(), subset->height()),
SkIPoint::Make(subset->x(), subset->y()), uniqueID);
diff --git a/src/core/SkLightingShader.h b/src/core/SkLightingShader.h
index f87db31..e918f3b 100644
--- a/src/core/SkLightingShader.h
+++ b/src/core/SkLightingShader.h
@@ -38,7 +38,7 @@
}
const Lights* finish() {
- return fLights.detach();
+ return fLights.release();
}
private:
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 0ba28b9..a27c31a 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -559,7 +559,7 @@
if (!data->parseStream(stream, proc, topLevelTFPlayback)) {
return nullptr;
}
- return data.detach();
+ return data.release();
}
SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer,
@@ -570,7 +570,7 @@
if (!data->parseBuffer(buffer)) {
return nullptr;
}
- return data.detach();
+ return data.release();
}
bool SkPictureData::parseStream(SkStream* stream,
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 62fa0e9..8fbfed0 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -92,8 +92,8 @@
for (int i = 0; pictList && i < pictList->count(); i++) {
subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
}
- return new SkBigPicture(fCullRect, fRecord.detach(), pictList, fBBH.detach(),
- saveLayerData.detach(), subPictureBytes);
+ return new SkBigPicture(fCullRect, fRecord.release(), pictList, fBBH.release(),
+ saveLayerData.release(), subPictureBytes);
}
SkPicture* SkPictureRecorder::endRecordingAsPicture(const SkRect& cullRect) {
@@ -173,7 +173,7 @@
// SkBigPicture will take ownership of a ref on both fRecord and fBBH.
// We're not willing to give up our ownership, so we must ref them for SkPicture.
return new SkBigPicture(fBounds, SkRef(fRecord.get()), pictList, SkSafeRef(fBBH.get()),
- saveLayerData.detach(), subPictureBytes);
+ saveLayerData.release(), subPictureBytes);
}
};
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index f9fd8bb..4e23da2 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -27,7 +27,7 @@
for (int i = 0; i < count; ++i) {
pics[i] = fArray[i]->newPictureSnapshot();
}
- return new SkBigPicture::SnapshotArray(pics.detach(), count);
+ return new SkBigPicture::SnapshotArray(pics.release(), count);
}
void SkDrawableList::append(SkDrawable* drawable) {
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 7372e54..44fb839 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -48,7 +48,7 @@
size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPictures; }
SkDrawableList* getDrawableList() const { return fDrawableList.get(); }
- SkDrawableList* detachDrawableList() { return fDrawableList.detach(); }
+ SkDrawableList* detachDrawableList() { return fDrawableList.release(); }
// Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecorder will fail.
void forgetRecord();
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 5e6fe68..fa3cb9d 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -279,7 +279,7 @@
size_t used = rec->bytesUsed();
SkASSERT(used <= fTotalBytesUsed);
- this->detach(rec);
+ this->release(rec);
fHash->remove(rec->getKey());
fTotalBytesUsed -= used;
@@ -395,7 +395,7 @@
///////////////////////////////////////////////////////////////////////////////
-void SkResourceCache::detach(Rec* rec) {
+void SkResourceCache::release(Rec* rec) {
Rec* prev = rec->fPrev;
Rec* next = rec->fNext;
@@ -425,7 +425,7 @@
this->validate();
- this->detach(rec);
+ this->release(rec);
fHead->fPrev = rec;
rec->fNext = fHead;
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index 548f17f..a8da4bd 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -276,7 +276,7 @@
// linklist management
void moveToHead(Rec*);
void addToHead(Rec*);
- void detach(Rec*);
+ void release(Rec*);
void remove(Rec*);
void init(); // called by constructors
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index b6d0a2b..a4c44fb 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -241,7 +241,7 @@
if (!fName.isEmpty()) {
SkAutoTDelete<SkFILEStream> that(new SkFILEStream(fName.c_str()));
if (sk_fidentical(that->fFILE, this->fFILE)) {
- return that.detach();
+ return that.release();
}
}
@@ -267,7 +267,7 @@
SkStreamAsset* SkFILEStream::fork() const {
SkAutoTDelete<SkStreamAsset> that(this->duplicate());
that->seek(this->getPosition());
- return that.detach();
+ return that.release();
}
size_t SkFILEStream::getLength() const {
@@ -403,7 +403,7 @@
SkMemoryStream* SkMemoryStream::fork() const {
SkAutoTDelete<SkMemoryStream> that(this->duplicate());
that->seek(fOffset);
- return that.detach();
+ return that.release();
}
size_t SkMemoryStream::getLength() const {
@@ -785,7 +785,7 @@
that->fCurrent = this->fCurrent;
that->fOffset = this->fOffset;
that->fCurrentOffset = this->fCurrentOffset;
- return that.detach();
+ return that.release();
}
size_t getLength() const override {
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index 7f6536c..79fe858 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -624,7 +624,7 @@
fStorage.realloc(fStorageUsed);
}
- const SkTextBlob* blob = new (fStorage.detach()) SkTextBlob(fRunCount, fBounds);
+ const SkTextBlob* blob = new (fStorage.release()) SkTextBlob(fRunCount, fBounds);
SkDEBUGCODE(const_cast<SkTextBlob*>(blob)->fStorageSize = fStorageSize;)
SkDEBUGCODE(
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 8d4233e..8b7620b 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -232,7 +232,7 @@
SkFontData* SkTypeface::onCreateFontData() const {
int index;
SkAutoTDelete<SkStreamAsset> stream(this->onOpenStream(&index));
- return new SkFontData(stream.detach(), index, nullptr, 0);
+ return new SkFontData(stream.release(), index, nullptr, 0);
};
int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding,
diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp
index acee70f..4d05353 100644
--- a/src/effects/SkBlurMask.cpp
+++ b/src/effects/SkBlurMask.cpp
@@ -600,7 +600,7 @@
clamp_with_orig(dp + passCount * (rx + ry * dst->fRowBytes),
dst->fRowBytes, sp, src.fRowBytes, sw, sh, style);
}
- (void)autoCall.detach();
+ (void)autoCall.release();
}
if (style == kInner_SkBlurStyle) {
@@ -982,7 +982,7 @@
clamp_with_orig(dstPixels + pad*dst->fRowBytes + pad,
dst->fRowBytes, srcPixels, src.fRowBytes, srcWidth, srcHeight, style);
}
- (void)autoCall.detach();
+ (void)autoCall.release();
}
if (style == kInner_SkBlurStyle) {
diff --git a/src/effects/gradients/SkGradientBitmapCache.cpp b/src/effects/gradients/SkGradientBitmapCache.cpp
index 24e7f58..cba103b 100644
--- a/src/effects/gradients/SkGradientBitmapCache.cpp
+++ b/src/effects/gradients/SkGradientBitmapCache.cpp
@@ -51,7 +51,7 @@
}
}
-SkGradientBitmapCache::Entry* SkGradientBitmapCache::detach(Entry* entry) const {
+SkGradientBitmapCache::Entry* SkGradientBitmapCache::release(Entry* entry) const {
if (entry->fPrev) {
SkASSERT(fHead != entry);
entry->fPrev->fNext = entry->fNext;
@@ -90,7 +90,7 @@
*bm = entry->fBitmap;
}
// move to the head of our list, so we purge it last
- this->detach(entry);
+ this->release(entry);
this->attachToHead(entry);
return true;
}
@@ -104,7 +104,7 @@
if (fEntryCount == fMaxEntries) {
SkASSERT(fTail);
- delete this->detach(fTail);
+ delete this->release(fTail);
fEntryCount -= 1;
}
diff --git a/src/effects/gradients/SkGradientBitmapCache.h b/src/effects/gradients/SkGradientBitmapCache.h
index 009b956..81bd214 100644
--- a/src/effects/gradients/SkGradientBitmapCache.h
+++ b/src/effects/gradients/SkGradientBitmapCache.h
@@ -28,7 +28,7 @@
mutable Entry* fHead;
mutable Entry* fTail;
- inline Entry* detach(Entry*) const;
+ inline Entry* release(Entry*) const;
inline void attachToHead(Entry*) const;
#ifdef SK_DEBUG
diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp
index de309d3..50af9b4 100644
--- a/src/fonts/SkFontMgr_fontconfig.cpp
+++ b/src/fonts/SkFontMgr_fontconfig.cpp
@@ -309,13 +309,13 @@
return nullptr;
}
- SkTypeface* face = FontConfigTypeface::Create(style, isFixedWidth, stream.detach());
+ SkTypeface* face = FontConfigTypeface::Create(style, isFixedWidth, stream.release());
return face;
}
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
+ return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
}
SkTypeface* onLegacyCreateTypeface(const char familyName[],
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index 2470f8a..fc0bd5c 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -125,7 +125,7 @@
if (dataTypeface.get() != nullptr) {
SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(nullptr));
if (stream.get() != nullptr) {
- return fImpl->createFromStream(stream.detach(), dataTypefaceIndex);
+ return fImpl->createFromStream(stream.release(), dataTypefaceIndex);
}
}
@@ -135,7 +135,7 @@
return nullptr;
}
- SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.detach(), id.fTtcIndex));
+ SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.release(), id.fTtcIndex));
if (typeface.get() == nullptr) {
return nullptr;
}
@@ -146,7 +146,7 @@
newEntry.fTtcIndex = id.fTtcIndex;
newEntry.fTypeface = typeface.get(); // weak reference passed to new entry.
- return typeface.detach();
+ return typeface.release();
}
SkTypeface* SkFontMgr_Indirect::onMatchFamilyStyle(const char familyName[],
@@ -205,5 +205,5 @@
face.reset(this->createTypefaceFromFontId(fontId));
}
- return face.detach();
+ return face.release();
}
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index f56a4e4..e04adee 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -713,7 +713,7 @@
}
}
- return texture.detach();
+ return texture.release();
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp
index b7e4825..bcf0c32 100755
--- a/src/gpu/GrContextFactory.cpp
+++ b/src/gpu/GrContextFactory.cpp
@@ -143,7 +143,7 @@
}
Context& context = fContexts.push_back();
- context.fGLContext = glCtx.detach();
+ context.fGLContext = glCtx.release();
context.fGrContext = SkRef(grCtx.get());
context.fType = type;
context.fOptions = options;
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index afeeda7..512ce9b 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -477,7 +477,7 @@
return specs;
}
const MultisampleSpecs& specs = *new (&fMultisampleSpecsAllocator)
- MultisampleSpecs{effectiveKey, effectiveSampleCnt, locations.detach()};
+ MultisampleSpecs{effectiveKey, effectiveSampleCnt, locations.release()};
if (fMultisampleSpecsMap.count() <= effectiveKey) {
int n = 1 + effectiveKey - fMultisampleSpecsMap.count();
fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr);
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index 7affae6..429a63a 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -119,7 +119,7 @@
SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtDesc.fHeight));
drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRect, localRect);
- return copy.detach();
+ return copy.release();
}
GrTextureAdjuster::GrTextureAdjuster(GrTexture* original,
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 708cbec..f35c6df 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -141,6 +141,6 @@
drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r);
- return result.detach();
+ return result.release();
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7a6d967..173fe30 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -335,7 +335,7 @@
SkASSERT(fRenderTarget != newRT);
- fRenderTarget.reset(newRT.detach());
+ fRenderTarget.reset(newRT.release());
#ifdef SK_DEBUG
SkImageInfo info = fRenderTarget->surfacePriv().info(fOpaque ? kOpaque_SkAlphaType :
diff --git a/src/gpu/batches/GrDrawPathBatch.cpp b/src/gpu/batches/GrDrawPathBatch.cpp
index a99f4eb..b115858 100644
--- a/src/gpu/batches/GrDrawPathBatch.cpp
+++ b/src/gpu/batches/GrDrawPathBatch.cpp
@@ -99,7 +99,7 @@
fTotalPathCount += that->fTotalPathCount;
while (Draw* head = that->fDraws.head()) {
Draw* draw = fDraws.addToTail();
- draw->fInstanceData.reset(head->fInstanceData.detach());
+ draw->fInstanceData.reset(head->fInstanceData.release());
draw->fX = head->fX;
draw->fY = head->fY;
that->fDraws.popHead();
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index ada6dbf..cf43173 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -60,7 +60,7 @@
} else {
SkASSERT(path->isEqualTo(skPath, stroke));
}
- return path.detach();
+ return path.release();
}
void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
diff --git a/src/gpu/gl/GrGLExtensions.cpp b/src/gpu/gl/GrGLExtensions.cpp
index 1ddc101..43a147d 100644
--- a/src/gpu/gl/GrGLExtensions.cpp
+++ b/src/gpu/gl/GrGLExtensions.cpp
@@ -125,7 +125,7 @@
if (idx >= 0) {
// This is not terribly effecient but we really only expect this function to be called at
// most a handful of times when our test programs start.
- SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.detach());
+ SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.release());
fStrings.reset(new SkTArray<SkString>(oldStrings->count() - 1));
fStrings->push_back_n(idx, &oldStrings->front());
fStrings->push_back_n(oldStrings->count() - idx - 1, &(*oldStrings)[idx] + 1);
diff --git a/src/gpu/gl/SkGLContext.cpp b/src/gpu/gl/SkGLContext.cpp
index 01f827c..ebe5032 100644
--- a/src/gpu/gl/SkGLContext.cpp
+++ b/src/gpu/gl/SkGLContext.cpp
@@ -140,7 +140,7 @@
return nullptr;
}
- return ret.detach();
+ return ret.release();
}
SkPlatformGpuFence SkGLContext::GLFenceSync::insertFence() const {
diff --git a/src/gpu/gl/angle/SkANGLEGLContext.cpp b/src/gpu/gl/angle/SkANGLEGLContext.cpp
index 2c9f38e..0e37a7e 100644
--- a/src/gpu/gl/angle/SkANGLEGLContext.cpp
+++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp
@@ -123,7 +123,7 @@
return;
}
- this->init(gl.detach());
+ this->init(gl.release());
}
SkANGLEGLContext::~SkANGLEGLContext() {
diff --git a/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp b/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
index cf9da93..b14debd 100644
--- a/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
+++ b/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
@@ -259,7 +259,7 @@
return;
}
- this->init(gl.detach());
+ this->init(gl.release());
}
SkCommandBufferGLContext::~SkCommandBufferGLContext() {
diff --git a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
index bf93973..09b7323 100644
--- a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
+++ b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp
@@ -179,7 +179,7 @@
continue;
}
- this->init(gl.detach(), SkEGLFenceSync::CreateIfSupported(fDisplay));
+ this->init(gl.release(), SkEGLFenceSync::CreateIfSupported(fDisplay));
break;
}
}
diff --git a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
index 51b8ce9..b91262f 100644
--- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
+++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp
@@ -284,7 +284,7 @@
return;
}
- this->init(gl.detach());
+ this->init(gl.release());
}
diff --git a/src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm b/src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm
index 5be351f..54dc59a 100644
--- a/src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm
+++ b/src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm
@@ -53,7 +53,7 @@
"/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib",
RTLD_LAZY);
- this->init(gl.detach());
+ this->init(gl.release());
}
IOSGLContext::~IOSGLContext() {
diff --git a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
index d1826a4..c6eb34b 100644
--- a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
@@ -77,7 +77,7 @@
"/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib",
RTLD_LAZY);
- this->init(gl.detach());
+ this->init(gl.release());
}
MacGLContext::~MacGLContext() {
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp
index 541b247..8b3666c 100644
--- a/src/gpu/gl/mesa/SkMesaGLContext.cpp
+++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp
@@ -63,7 +63,7 @@
return;
}
- this->init(gl.detach());
+ this->init(gl.release());
}
SkMesaGLContext::~SkMesaGLContext() {
diff --git a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
index 6cc1143..da13ee7 100644
--- a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
+++ b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp
@@ -127,7 +127,7 @@
return;
}
- this->init(gl.detach());
+ this->init(gl.release());
}
WinGLContext::~WinGLContext() {
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 8a78f45..1970c57 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -134,7 +134,7 @@
}
SkAutoTUnref<SkData> encoded(this->refEncoded());
if (encoded && effectiveSerializer->useEncodedData(encoded->data(), encoded->size())) {
- return encoded.detach();
+ return encoded.release();
}
SkBitmap bm;
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 0cb0e02..ba4a50f 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -137,7 +137,7 @@
return dst->tryAllocPixels();
}
SkAutoTUnref<SkDiscardablePixelRef> ref(
- new SkDiscardablePixelRef(prInfo, autoGenerator.detach(), dst->rowBytes(), factory));
+ new SkDiscardablePixelRef(prInfo, autoGenerator.release(), dst->rowBytes(), factory));
dst->setPixelRef(ref, origin.x(), origin.y());
return true;
}
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index 5687dd4..c0147bc 100755
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -481,7 +481,7 @@
return true;
}
-void SkOpCoincidence::detach(SkCoincidentSpans* remove) {
+void SkOpCoincidence::release(SkCoincidentSpans* remove) {
SkCoincidentSpans* coin = fHead;
SkCoincidentSpans* prev = nullptr;
SkCoincidentSpans* next;
@@ -604,28 +604,28 @@
do {
if (coin->fCoinPtTStart == deleted) {
if (coin->fCoinPtTEnd->span() == kept->span()) {
- this->detach(coin);
+ this->release(coin);
continue;
}
coin->fCoinPtTStart = kept;
}
if (coin->fCoinPtTEnd == deleted) {
if (coin->fCoinPtTStart->span() == kept->span()) {
- this->detach(coin);
+ this->release(coin);
continue;
}
coin->fCoinPtTEnd = kept;
}
if (coin->fOppPtTStart == deleted) {
if (coin->fOppPtTEnd->span() == kept->span()) {
- this->detach(coin);
+ this->release(coin);
continue;
}
coin->fOppPtTStart = kept;
}
if (coin->fOppPtTEnd == deleted) {
if (coin->fOppPtTStart->span() == kept->span()) {
- this->detach(coin);
+ this->release(coin);
continue;
}
coin->fOppPtTEnd = kept;
diff --git a/src/pathops/SkOpCoincidence.h b/src/pathops/SkOpCoincidence.h
index 91da2e1..96bd21a 100644
--- a/src/pathops/SkOpCoincidence.h
+++ b/src/pathops/SkOpCoincidence.h
@@ -79,7 +79,7 @@
return SkDEBUGRELEASE(fDebugState->debugSpan(id), nullptr);
}
- void detach(SkCoincidentSpans* );
+ void release(SkCoincidentSpans* );
void dump() const;
bool expand();
bool extend(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart,
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 2ba7d79..24f76aa 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -571,7 +571,7 @@
return start->starter(end)->windSum();
}
-void SkOpSegment::detach(const SkOpSpan* span) {
+void SkOpSegment::release(const SkOpSpan* span) {
if (span->done()) {
--fDoneCount;
}
@@ -1407,10 +1407,10 @@
SkOpSpanBase* next;
if (spanS->contains(test)) {
if (!test->final()) {
- test->upCast()->detach(spanS->ptT());
+ test->upCast()->release(spanS->ptT());
continue;
} else if (spanS != &fHead) {
- spanS->upCast()->detach(test->ptT());
+ spanS->upCast()->release(test->ptT());
spanS = test;
continue;
}
diff --git a/src/pathops/SkOpSegment.h b/src/pathops/SkOpSegment.h
index 40a50c5..2a51d34 100644
--- a/src/pathops/SkOpSegment.h
+++ b/src/pathops/SkOpSegment.h
@@ -173,7 +173,7 @@
const SkOpSpanBase* debugSpan(int id) const;
void debugValidate() const;
- void detach(const SkOpSpan* );
+ void release(const SkOpSpan* );
double distSq(double t, const SkOpAngle* opp) const;
bool done() const {
diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp
index 7c98e1d..f336223 100755
--- a/src/pathops/SkOpSpan.cpp
+++ b/src/pathops/SkOpSpan.cpp
@@ -138,7 +138,7 @@
SkOpSpanBase* span = next->span();
next->setDeleted();
if (span->ptT() == next) {
- span->upCast()->detach(kept);
+ span->upCast()->release(kept);
}
}
@@ -293,7 +293,7 @@
SkOpPtT* spanPtT = span->ptT();
SkASSERT(this->t() != spanPtT->fT);
SkASSERT(!zero_or_one(spanPtT->fT));
- span->detach(this->ptT());
+ span->release(this->ptT());
SkOpPtT* remainder = spanPtT->next();
ptT()->insert(spanPtT);
while (remainder != spanPtT) {
@@ -334,7 +334,7 @@
return false;
}
-void SkOpSpan::detach(SkOpPtT* kept) {
+void SkOpSpan::release(SkOpPtT* kept) {
SkASSERT(!final());
SkOpSpan* prev = this->prev();
SkASSERT(prev);
@@ -342,7 +342,7 @@
SkASSERT(next);
prev->setNext(next);
next->setPrev(prev);
- this->segment()->detach(this);
+ this->segment()->release(this);
SkOpCoincidence* coincidence = this->globalState()->coincidence();
if (coincidence) {
coincidence->fixUp(this->ptT(), kept);
diff --git a/src/pathops/SkOpSpan.h b/src/pathops/SkOpSpan.h
index e512554..c6fc4b1 100644
--- a/src/pathops/SkOpSpan.h
+++ b/src/pathops/SkOpSpan.h
@@ -404,7 +404,7 @@
}
bool debugCoinLoopCheck() const;
- void detach(SkOpPtT* );
+ void release(SkOpPtT* );
bool done() const {
SkASSERT(!final());
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 86d4d07..94a103a 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -595,9 +595,9 @@
// If the stack is too deep we could get Stack Overflow.
// So we manually destruct the object.
~ContentEntry() {
- ContentEntry* val = fNext.detach();
+ ContentEntry* val = fNext.release();
while (val != nullptr) {
- ContentEntry* valNext = val->fNext.detach();
+ ContentEntry* valNext = val->fNext.release();
// When the destructor is called, fNext is nullptr and exits.
delete val;
val = valNext;
@@ -1851,7 +1851,7 @@
contentEntries->reset(entry);
setLastContentEntry(entry);
} else if (xfermode == SkXfermode::kDstOver_Mode) {
- entry->fNext.reset(contentEntries->detach());
+ entry->fNext.reset(contentEntries->release());
contentEntries->reset(entry);
} else {
lastContentEntry->fNext.reset(entry);
@@ -1885,7 +1885,7 @@
// of the content entries. If nothing was drawn, it needs to be
// removed.
SkAutoTDelete<ContentEntry>* contentEntries = getContentEntries();
- contentEntries->reset(firstContentEntry->fNext.detach());
+ contentEntries->reset(firstContentEntry->fNext.release());
}
return;
}
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index bacd9ec..4895dc5 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -399,6 +399,6 @@
auto delete_wstream = [](SkWStream* stream, bool) { delete stream; };
SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
return stream->isValid()
- ? SkPDFMakeDocument(stream.detach(), delete_wstream, dpi, nullptr).release()
+ ? SkPDFMakeDocument(stream.release(), delete_wstream, dpi, nullptr).release()
: nullptr;
}
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 59bfc8f..ac98433 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -267,7 +267,7 @@
uint8_t* const resultTrailer = &(buffer[SkToInt(*headerLen + outputOffset)]);
memcpy(resultTrailer, src + *headerLen + hexDataLen, *trailerLen);
- return SkData::NewFromMalloc(buffer.detach(), length);
+ return SkData::NewFromMalloc(buffer.release(), length);
}
return nullptr;
}
@@ -1077,7 +1077,7 @@
SkASSERT(fontData);
fontSize = fontData->getLength();
SkASSERT(fontSize > 0);
- fontStream.reset(new SkPDFSharedStream(fontData.detach()));
+ fontStream.reset(new SkPDFSharedStream(fontData.release()));
fontStream->dict()->insertInt("Length1", fontSize);
descriptor->insertObjRef("FontFile2", std::move(fontStream));
break;
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 2ae3217..f5e5b1e 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -622,7 +622,7 @@
auto alphaGs = create_smask_graphic_state(canon, dpi, state);
SkPDFAlphaFunctionShader* alphaFunctionShader =
- new SkPDFAlphaFunctionShader(autoState->detach());
+ new SkPDFAlphaFunctionShader(autoState->release());
auto resourceDict =
get_gradient_resource_dict(colorShader.get(), alphaGs.get());
@@ -809,7 +809,7 @@
pdfShader->insertObjRef("Function", std::move(function));
sk_sp<SkPDFFunctionShader> pdfFunctionShader(
- new SkPDFFunctionShader(autoState->detach()));
+ new SkPDFFunctionShader(autoState->release()));
pdfFunctionShader->insertInt("PatternType", 2);
pdfFunctionShader->insertObject("Matrix",
SkPDFUtils::MatrixToArray(finalMatrix));
@@ -1021,7 +1021,7 @@
// Put the canvas into the pattern stream (fContent).
auto content = patternDevice->content();
- SkPDFImageShader* imageShader = new SkPDFImageShader(autoState->detach());
+ SkPDFImageShader* imageShader = new SkPDFImageShader(autoState->release());
imageShader->setData(content.get());
auto resourceDict = patternDevice->makeResourceDict();
diff --git a/src/pdf/SkPDFStream.cpp b/src/pdf/SkPDFStream.cpp
index b8f2e4e..8b8f323 100644
--- a/src/pdf/SkPDFStream.cpp
+++ b/src/pdf/SkPDFStream.cpp
@@ -45,7 +45,7 @@
if (dup && dup->hasLength() &&
dup->getLength() <= length + strlen("/Filter_/FlateDecode_")) {
this->insertInt("Length", dup->getLength());
- fCompressedData.reset(dup.detach());
+ fCompressedData.reset(dup.release());
return;
}
}
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index f1724b6..69f660c 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -105,7 +105,7 @@
}
}
- CFRef detach() {
+ CFRef release() {
CFRef self = fCFRef;
fCFRef = nullptr;
return self;
@@ -550,7 +550,7 @@
SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_CTFontRef, (void*)ctFont.get());
if (!face) {
- face = NewFromFontRef(ctFont.detach(), nullptr, nullptr, false);
+ face = NewFromFontRef(ctFont.release(), nullptr, nullptr, false);
SkTypefaceCache::Add(face, face->fontStyle());
}
return face;
@@ -1867,9 +1867,9 @@
CFIndex cgAxisCount;
SkAutoSTMalloc<4, SkFixed> axisValues;
if (get_variations(fFontRef, &cgAxisCount, &axisValues)) {
- return new SkFontData(stream.detach(), index, axisValues.get(), cgAxisCount);
+ return new SkFontData(stream.release(), index, axisValues.get(), cgAxisCount);
}
- return new SkFontData(stream.detach(), index, nullptr, 0);
+ return new SkFontData(stream.release(), index, nullptr, 0);
}
///////////////////////////////////////////////////////////////////////////////
@@ -2199,7 +2199,7 @@
bool isFixedPitch;
(void)computeStyleBits(ctFont, &isFixedPitch);
- face = new SkTypeface_Mac(ctFont.detach(), nullptr, cacheRequest.fStyle, isFixedPitch,
+ face = new SkTypeface_Mac(ctFont.release(), nullptr, cacheRequest.fStyle, isFixedPitch,
skFamilyName.c_str(), false);
SkTypefaceCache::Add(face, face->fontStyle());
return face;
@@ -2497,14 +2497,14 @@
if (cgVariations) {
cgVariant.reset(CGFontCreateCopyWithVariations(cg, cgVariations));
} else {
- cgVariant.reset(cg.detach());
+ cgVariant.reset(cg.release());
}
CTFontRef ct = CTFontCreateWithGraphicsFont(cgVariant, 0, nullptr, nullptr);
if (!ct) {
return nullptr;
}
- return NewFromFontRef(ct, cg.detach(), nullptr, true);
+ return NewFromFontRef(ct, cg.release(), nullptr, true);
}
static CFDictionaryRef get_axes(CGFontRef cg, SkFontData* fontData) {
@@ -2580,14 +2580,14 @@
if (cgVariations) {
cgVariant.reset(CGFontCreateCopyWithVariations(cg, cgVariations));
} else {
- cgVariant.reset(cg.detach());
+ cgVariant.reset(cg.release());
}
CTFontRef ct = CTFontCreateWithGraphicsFont(cgVariant, 0, nullptr, nullptr);
if (!ct) {
return nullptr;
}
- return NewFromFontRef(ct, cg.detach(), nullptr, true);
+ return NewFromFontRef(ct, cg.release(), nullptr, true);
}
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 93a7d86..ead0bf0 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -388,7 +388,7 @@
uint16_t glyphID;
paint.textToGlyphs(&character, sizeof(character), &glyphID);
if (glyphID != 0) {
- return face.detach();
+ return face.release();
}
}
return nullptr;
@@ -438,7 +438,7 @@
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
+ return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
}
SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) const override {
@@ -449,7 +449,7 @@
if (!fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, nullptr)) {
return nullptr;
}
- SkFontData* data(new SkFontData(stream.detach(), ttcIndex, nullptr, 0));
+ SkFontData* data(new SkFontData(stream.release(), ttcIndex, nullptr, 0));
return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
}
@@ -471,7 +471,7 @@
SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count());
Scanner::computeAxisValues(axisDefinitions, paramAxes, paramAxisCount, axisValues, name);
- SkFontData* data(new SkFontData(stream.detach(), params.getCollectionIndex(),
+ SkFontData* data(new SkFontData(stream.release(), params.getCollectionIndex(),
axisValues.get(), axisDefinitions.count()));
return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
}
diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp
index 3f9c90c..dbc1dee 100644
--- a/src/ports/SkFontMgr_android_parser.cpp
+++ b/src/ports/SkFontMgr_android_parser.cpp
@@ -273,7 +273,7 @@
}
},
/*end*/[](FamilyData* self, const char* tag) {
- *self->fFamilies.append() = self->fCurrentFamily.detach();
+ *self->fFamilies.append() = self->fCurrentFamily.release();
},
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
@@ -473,7 +473,7 @@
}
},
/*end*/[](FamilyData* self, const char* tag) {
- *self->fFamilies.append() = self->fCurrentFamily.detach();
+ *self->fFamilies.append() = self->fCurrentFamily.release();
},
/*tag*/[](FamilyData* self, const char* tag, const char** attributes) -> const TagHandler* {
size_t len = strlen(tag);
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index 7f3ce6b..158ba00 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -296,7 +296,7 @@
SkFontStyle style;
SkString name;
if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, nullptr)) {
- return new SkTypeface_Stream(style, isFixedPitch, false, name, stream.detach(),
+ return new SkTypeface_Stream(style, isFixedPitch, false, name, stream.release(),
ttcIndex);
} else {
return nullptr;
@@ -305,7 +305,7 @@
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
+ return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
}
SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
@@ -489,7 +489,7 @@
SkTypeface_Custom* tf =
new SkTypeface_Stream(style, isFixedPitch, true, // system-font (cannot delete)
- realname, stream.detach(), faceIndex);
+ realname, stream.release(), faceIndex);
SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str());
if (nullptr == addTo) {
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index bd6a5a2..089be5c 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -196,8 +196,8 @@
FcPatternAddString(weak, object, (const FcChar8*)"nomatchstring");
FcPatternAddLangSet(weak, FC_LANG, weakLangSet);
- FcFontSetAdd(fontSet, strong.detach());
- FcFontSetAdd(fontSet, weak.detach());
+ FcFontSetAdd(fontSet, strong.release());
+ FcFontSetAdd(fontSet, weak.release());
// Add 'matchlang' to the copy of the pattern.
FcPatternAddLangSet(minimal, FC_LANG, weakLangSet);
@@ -725,7 +725,7 @@
}
}
- return new StyleSet(this, matches.detach());
+ return new StyleSet(this, matches.release());
}
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
@@ -830,7 +830,7 @@
return nullptr;
}
- return new SkTypeface_stream(new SkFontData(stream.detach(), ttcIndex, nullptr, 0), style,
+ return new SkTypeface_stream(new SkFontData(stream.release(), ttcIndex, nullptr, 0), style,
isFixedWidth);
}
@@ -852,7 +852,7 @@
SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count());
Scanner::computeAxisValues(axisDefinitions, paramAxes, paramAxisCount, axisValues, name);
- SkFontData* data(new SkFontData(stream.detach(), params.getCollectionIndex(),
+ SkFontData* data(new SkFontData(stream.release(), params.getCollectionIndex(),
axisValues.get(), axisDefinitions.count()));
return new SkTypeface_stream(data, style, isFixedPitch);
}
@@ -893,7 +893,7 @@
: SkFontStyle::kUpright_Slant);
SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, style));
if (typeface.get()) {
- return typeface.detach();
+ return typeface.release();
}
return this->matchFamilyStyle(nullptr, style);
diff --git a/src/ports/SkImageGeneratorCG.cpp b/src/ports/SkImageGeneratorCG.cpp
index a3474a1..9be0b8c 100644
--- a/src/ports/SkImageGeneratorCG.cpp
+++ b/src/ports/SkImageGeneratorCG.cpp
@@ -66,7 +66,7 @@
// though I think it makes sense to wait until we understand how
// we want to communicate it to the generator.
- return new SkImageGeneratorCG(info, autoImageSrc.detach(), data);
+ return new SkImageGeneratorCG(info, autoImageSrc.release(), data);
}
SkImageGeneratorCG::SkImageGeneratorCG(const SkImageInfo& info, const void* imageSrc, SkData* data)
diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp
index d200173..cdf186c 100644
--- a/src/ports/SkRemotableFontMgr_win_dw.cpp
+++ b/src/ports/SkRemotableFontMgr_win_dw.cpp
@@ -172,7 +172,7 @@
HRN(FontToIdentity(font.get(), &fontIds[fontIndex]));
}
- return fontIdSet.detach();
+ return fontIdSet.release();
}
virtual SkFontIdentity matchIndexStyle(int familyIndex,
diff --git a/src/sfnt/SkOTUtils.cpp b/src/sfnt/SkOTUtils.cpp
index 683d750..cb533ff 100644
--- a/src/sfnt/SkOTUtils.cpp
+++ b/src/sfnt/SkOTUtils.cpp
@@ -174,7 +174,7 @@
return nullptr;
}
- return new SkOTUtils::LocalizedStrings_NameTable((SkOTTableName*)nameTableData.detach(),
+ return new SkOTUtils::LocalizedStrings_NameTable((SkOTTableName*)nameTableData.release(),
SkOTUtils::LocalizedStrings_NameTable::familyNameTypes,
SK_ARRAY_COUNT(SkOTUtils::LocalizedStrings_NameTable::familyNameTypes));
}
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 669a6c2..2c34d36 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -260,7 +260,7 @@
canvasState->layers = (SkCanvasLayerState*) sk_malloc_throw(layerWriter.bytesWritten());
layerWriter.flatten(canvasState->layers);
- return canvasState.detach();
+ return canvasState.release();
}
////////////////////////////////////////////////////////////////////////////////
@@ -311,7 +311,7 @@
// setup the matrix and clip
setup_canvas_from_MC_state(layerState.mcState, canvas.get());
- return canvas.detach();
+ return canvas.release();
}
SkCanvas* SkCanvasStateUtils::CreateFromCanvasState(const SkCanvasState* state) {
@@ -340,7 +340,7 @@
state_v1->layers[i].y));
}
- return canvas.detach();
+ return canvas.release();
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index a0dbeb6..2dfb8ab 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -147,7 +147,7 @@
// If we have read past the end of the buffer, rewinding is no longer
// supported, so we can go ahead and free the memory.
if (bytesReadDirectly > 0) {
- sk_free(fBuffer.detach());
+ sk_free(fBuffer.release());
}
return bytesReadDirectly;
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index d4bf8a2..460f90e 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -107,7 +107,7 @@
SkDWriteFontFileStream* SkDWriteFontFileStream::fork() const {
SkAutoTDelete<SkDWriteFontFileStream> that(this->duplicate());
that->seek(fPos);
- return that.detach();
+ return that.release();
}
size_t SkDWriteFontFileStream::getLength() const {
@@ -212,7 +212,7 @@
}
*fragmentStart = streamData.get();
- *fragmentContext = streamData.detach();
+ *fragmentContext = streamData.release();
}
return S_OK;
}
diff --git a/src/views/ios/SkOSWindow_iOS.mm b/src/views/ios/SkOSWindow_iOS.mm
index 04a219b..2a74ed6 100755
--- a/src/views/ios/SkOSWindow_iOS.mm
+++ b/src/views/ios/SkOSWindow_iOS.mm
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#import <UIKit/UIKit.h>
#include "SkCanvas.h"
#include "SkGraphics.h"
@@ -58,7 +65,7 @@
return success;
}
-void SkOSWindow::detach() {}
+void SkOSWindow::release() {}
void SkOSWindow::present() {
}
diff --git a/src/views/mac/SkOSWindow_Mac.mm b/src/views/mac/SkOSWindow_Mac.mm
index 9dbbe5b..ee53721 100644
--- a/src/views/mac/SkOSWindow_Mac.mm
+++ b/src/views/mac/SkOSWindow_Mac.mm
@@ -69,7 +69,7 @@
return [(SkNSView*)fHWND attach:attachType withMSAASampleCount:sampleCount andGetInfo:info];
}
-void SkOSWindow::detach() {
+void SkOSWindow::release() {
[(SkNSView*)fHWND detach];
}
diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp
index c39a4fd..76d4349 100644
--- a/src/views/sdl/SkOSWindow_SDL.cpp
+++ b/src/views/sdl/SkOSWindow_SDL.cpp
@@ -50,7 +50,7 @@
return nullptr;
}
-void SkOSWindow::detach() {
+void SkOSWindow::release() {
if (fGLContext) {
SDL_GL_DeleteContext(fGLContext);
fGLContext = nullptr;
@@ -76,7 +76,7 @@
if (SDL_GL_MakeCurrent(fWindow, fGLContext) != 0) {
report_sdl_error("Failed to make SDL GL context current.");
- this->detach();
+ this->release();
return false;
}
@@ -219,7 +219,7 @@
}
void SkOSWindow::destroyWindow() {
- this->detach();
+ this->release();
if (fWindow) {
SDL_DestroyWindow(fWindow);
fWindow = nullptr;
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index 1c288f4..7833bbe 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -47,7 +47,7 @@
void SkOSWindow::internalCloseWindow() {
if (fUnixWindow.fDisplay) {
- this->detach();
+ this->release();
SkASSERT(fUnixWindow.fGc);
XFreeGC(fUnixWindow.fDisplay, fUnixWindow.fGc);
fUnixWindow.fGc = nullptr;
@@ -378,7 +378,7 @@
return true;
}
-void SkOSWindow::detach() {
+void SkOSWindow::release() {
if (nullptr == fUnixWindow.fDisplay || nullptr == fUnixWindow.fGLContext) {
return;
}
diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp
index c451708..ee851a1 100644
--- a/src/views/win/SkOSWindow_win.cpp
+++ b/src/views/win/SkOSWindow_win.cpp
@@ -636,7 +636,7 @@
return result;
}
-void SkOSWindow::detach() {
+void SkOSWindow::release() {
switch (fAttached) {
case kNone_BackEndType:
// nothing to do
diff --git a/src/xps/SkDocument_XPS.cpp b/src/xps/SkDocument_XPS.cpp
index 0e241d9..33edf78 100644
--- a/src/xps/SkDocument_XPS.cpp
+++ b/src/xps/SkDocument_XPS.cpp
@@ -76,7 +76,7 @@
if (!stream->isValid()) {
return nullptr;
}
- return new SkDocument_XPS(stream.detach(), delete_wstream, dpi);
+ return new SkDocument_XPS(stream.release(), delete_wstream, dpi);
}
#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index e4ac2aa..5d12c49 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -420,10 +420,10 @@
}
SkAutoTDelete<SkMemoryStream> newStream(new SkMemoryStream());
- newStream->setMemoryOwned(fontPackageBuffer.detach(), bytesWritten + extra);
+ newStream->setMemoryOwned(fontPackageBuffer.release(), bytesWritten + extra);
SkTScopedComPtr<IStream> newIStream;
- SkIStream::CreateFromSkStream(newStream.detach(), true, &newIStream);
+ SkIStream::CreateFromSkStream(newStream.release(), true, &newIStream);
XPS_FONT_EMBEDDING embedding;
HRM(current->xpsFont->GetEmbeddingOption(&embedding),
diff --git a/tests/BadIcoTest.cpp b/tests/BadIcoTest.cpp
index c387e15..5c01490 100644
--- a/tests/BadIcoTest.cpp
+++ b/tests/BadIcoTest.cpp
@@ -31,7 +31,7 @@
for (size_t i = 0; i < SK_ARRAY_COUNT(badImages); ++i) {
SkString fullPath = SkOSPath::Join(resourcePath.c_str(), badImages[i]);
SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fullPath.c_str()));
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
// These images are corrupt. It's not important whether we succeed/fail in codec
// creation or decoding. We just want to make sure that we don't crash.
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index a0d71bb..fe6b412 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -255,7 +255,7 @@
SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter, colorType));
REPORTER_ASSERT(reporter, gen.get() != nullptr);
SkBitmap lazy;
- bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, factory);
+ bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.release(), nullptr, &lazy, factory);
REPORTER_ASSERT(reporter, success);
if (TestImageGenerator::kSucceedGetPixels_TestType == type) {
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index 907fd7d..be25dc3 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -171,7 +171,7 @@
SkAutoTUnref<SkData> data((SkData::NewFromStream(stream, 2 * size / 3)));
codec.reset(SkCodec::NewFromData(data));
} else {
- codec.reset(SkCodec::NewFromStream(stream.detach()));
+ codec.reset(SkCodec::NewFromStream(stream.release()));
}
if (!codec) {
ERRORF(r, "Unable to decode '%s'", path);
@@ -300,7 +300,7 @@
SkAutoTUnref<SkData> data((SkData::NewFromStream(stream, 2 * size / 3)));
androidCodec.reset(SkAndroidCodec::NewFromData(data));
} else {
- androidCodec.reset(SkAndroidCodec::NewFromStream(stream.detach()));
+ androidCodec.reset(SkAndroidCodec::NewFromStream(stream.release()));
}
if (!androidCodec) {
ERRORF(r, "Unable to decode '%s'", path);
@@ -412,7 +412,7 @@
SkDebugf("Missing resource '%s'\n", path);
}
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(r, codec);
if (!codec) {
@@ -545,7 +545,7 @@
SkDebugf("Missing resource '%s'\n", path);
return;
}
- SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.release()));
if (!codec) {
ERRORF(r, "Unable to create codec '%s'", path);
return;
@@ -610,7 +610,7 @@
SkDebugf("Missing resource '%s'\n", path);
return;
}
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(r, nullptr == codec);
}
@@ -636,7 +636,7 @@
SkDebugf("Missing resource '%s'\n", path);
return;
}
- SkAutoTDelete<SkCodec> decoder(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> decoder(SkCodec::NewFromStream(stream.release()));
// This should return kSuccess because kIndex8 is supported.
SkPMColor colorStorage[256];
@@ -954,7 +954,7 @@
0x83, 0xFF, 0x7F, // W: 65535
0x83, 0xFF, 0x7F }; // H: 65535
SkAutoTDelete<SkStream> stream(new SkMemoryStream(maxSizeWbmp, sizeof(maxSizeWbmp), false));
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(r, codec);
if (!codec) return;
@@ -968,7 +968,7 @@
0x84, 0x80, 0x00, // W: 65536
0x84, 0x80, 0x00 }; // H: 65536
stream.reset(new SkMemoryStream(tooBigWbmp, sizeof(tooBigWbmp), false));
- codec.reset(SkCodec::NewFromStream(stream.detach()));
+ codec.reset(SkCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(r, !codec);
}
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index 555f41e..3361aa3 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -27,7 +27,7 @@
SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png"));
REPORTER_ASSERT(r, nullptr != stream);
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(r, nullptr != codec);
#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index f4cc5bf..0b43655 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -98,7 +98,7 @@
int ttcIndex;
SkAutoTDelete<SkStreamAsset> fontData(origTypeface->openStream(&ttcIndex));
- SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.detach());
+ SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.release());
SkFontDescriptor desc;
bool isLocalStream = false;
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index d2bb43a..445f0bf 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -285,5 +285,5 @@
// This will fail to create a codec. However, what we really want to test is that we
// won't read past the end of the stream.
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
}
diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp
index caa0f6f..7f02cc1 100644
--- a/tests/GifTest.cpp
+++ b/tests/GifTest.cpp
@@ -198,7 +198,7 @@
return;
}
- SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(r, codec);
if (!codec) {
return;
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index eb84b3c..d6a88cf 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -372,7 +372,7 @@
} else {
SkFixed axis = SK_FixedSqrt2;
SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromFontData(
- new SkFontData(distortable.detach(), 0, &axis, 1)));
+ new SkFontData(distortable.release(), 0, &axis, 1)));
if (!typeface) {
INFOF(reporter, "Could not run fontstream test because Distortable.ttf not created.");
} else {
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index 4dad52b..c431abc 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -33,9 +33,9 @@
REPORTER_ASSERT(reporter, &obj == tmp.get());
REPORTER_ASSERT(reporter, obj.unique());
- REPORTER_ASSERT(reporter, &obj == tmp.detach());
+ REPORTER_ASSERT(reporter, &obj == tmp.release());
REPORTER_ASSERT(reporter, obj.unique());
- REPORTER_ASSERT(reporter, nullptr == tmp.detach());
+ REPORTER_ASSERT(reporter, nullptr == tmp.release());
REPORTER_ASSERT(reporter, nullptr == tmp.get());
obj.ref();
diff --git a/tests/YUVTest.cpp b/tests/YUVTest.cpp
index e1d8961..f7b3306 100644
--- a/tests/YUVTest.cpp
+++ b/tests/YUVTest.cpp
@@ -25,7 +25,7 @@
INFOF(reporter, "Missing resource '%s'\n", path);
return;
}
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
REPORTER_ASSERT(reporter, codec);
if (!codec) {
return;
diff --git a/tools/Resources.cpp b/tools/Resources.cpp
index 62b3f9f..ecbf88c 100644
--- a/tools/Resources.cpp
+++ b/tools/Resources.cpp
@@ -42,7 +42,7 @@
SkString resourcePath = GetResourcePath(resource);
SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str()));
if (stream->isValid()) {
- return stream.detach();
+ return stream.release();
} else {
SkDebugf("Resource %s not found.\n", resource);
return nullptr;
@@ -54,5 +54,5 @@
if (!stream) {
return nullptr;
}
- return SkTypeface::CreateFromStream(stream.detach());
+ return SkTypeface::CreateFromStream(stream.release());
}
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index 6d0268a..69d47b6 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -108,7 +108,7 @@
int screenSamples = FLAGS_offscreen ? 0 : FLAGS_msaa;
if (!this->attach(kNativeGL_BackEndType, screenSamples, &fAttachmentInfo)) {
SkDebugf("Not possible to create backend.\n");
- INHERITED::detach();
+ INHERITED::release();
SkFAIL("Could not create backend\n");
}
@@ -139,7 +139,7 @@
fContext.reset();
fSurface.reset();
fInterface.reset();
- this->detach();
+ this->release();
}
}
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp
index 9fd2a29..e0d02f2 100644
--- a/tools/VisualBench/VisualBenchmarkStream.cpp
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp
@@ -168,7 +168,7 @@
if (gm->runAsBench()) {
fSourceType = "gm";
fBenchType = "micro";
- return new GMBench(gm.detach());
+ return new GMBench(gm.release());
}
}
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index e342c44..2f5a875 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -769,10 +769,10 @@
const char* ctName = jsonBitmap[SKDEBUGCANVAS_ATTRIBUTE_COLOR].asCString();
SkColorType ct = colortype_from_name(ctName);
if (ct != kIndex_8_SkColorType) {
- bitmap.reset(convert_colortype(bitmap.detach(), ct));
+ bitmap.reset(convert_colortype(bitmap.release(), ct));
}
}
- return bitmap.detach();
+ return bitmap.release();
}
SkDebugf("image decode failed\n");
return nullptr;