diff options
113 files changed, 215 insertions, 213 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index dd792dd39a..88dd74f92d 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -647,7 +647,7 @@ public: } } while(SkCommandLineFlags::ShouldSkip(FLAGS_sourceType, fSourceType) || SkCommandLineFlags::ShouldSkip(FLAGS_benchType, fBenchType)); - return bench.detach(); + return bench.release(); } Benchmark* rawNext() { @@ -665,7 +665,7 @@ public: if (gm->runAsBench()) { fSourceType = "gm"; fBenchType = "micro"; - return new GMBench(gm.detach()); + return new GMBench(gm.release()); } } @@ -315,7 +315,7 @@ static void push_src(const char* tag, ImplicitString options, Src* s) { 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 @@ static void push_sink(const SkCommandLineConfig& config, Sink* s) { } 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 134c7a37e0..27cb6aa54e 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -818,7 +818,7 @@ Error ImageGenSrc::draw(SkCanvas* canvas) const { // 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 e30c4674e8..817bbaa463 100644 --- a/example/HelloWorld.cpp +++ b/example/HelloWorld.cpp @@ -49,7 +49,7 @@ void HelloWorldWindow::tearDownBackend() { SkSafeUnref(fRenderTarget); fRenderTarget = NULL; - INHERITED::detach(); + INHERITED::release(); } void HelloWorldWindow::setTitle() { @@ -65,7 +65,7 @@ bool HelloWorldWindow::setUpBackend() { 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 0c5209fa26..bd6d533cc8 100644 --- a/experimental/iOSSampleApp/SkSampleUIView.mm +++ b/experimental/iOSSampleApp/SkSampleUIView.mm @@ -97,7 +97,7 @@ public: 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 @@ public: 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 98c5b286c8..d02e3deffb 100644 --- a/experimental/tools/coreGraphicsPdf2png.cpp +++ b/experimental/tools/coreGraphicsPdf2png.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) { 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 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(); 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 7da4fa81ca..2ae72230a8 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 @@ bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int /*msaaSampleCount*/ 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 76ace6df46..644191d3d7 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(void* hwnd) { } SkOSWindow::~SkOSWindow() { - this->detach(); + this->release(); } bool SkOSWindow::attach(SkBackEndTypes attachType, @@ -149,7 +149,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, } } -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 6d5f647b15..72122234d9 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -261,7 +261,7 @@ public: 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 @@ public: SkSafeUnref(fCurRenderTarget); fCurRenderTarget = nullptr; #endif - win->detach(); + win->release(); fBackend = kNone_BackEndType; } diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp index 43e7cf49e5..9203cbad77 100644 --- a/samplecode/SamplePictFile.cpp +++ b/samplecode/SamplePictFile.cpp @@ -191,7 +191,7 @@ private: 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 a153282b09..712034ba44 100644 --- a/src/android/SkBitmapRegionDecoder.cpp +++ b/src/android/SkBitmapRegionDecoder.cpp @@ -24,7 +24,7 @@ SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create( 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 @@ SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create( 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 @@ SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create( 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 6c3efe095a..6db0991c0d 100644 --- a/src/codec/SkAndroidCodec.cpp +++ b/src/codec/SkAndroidCodec.cpp @@ -41,14 +41,14 @@ SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader #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 5616a650a6..32f1d15277 100644 --- a/src/codec/SkBmpCodec.cpp +++ b/src/codec/SkBmpCodec.cpp @@ -509,7 +509,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { 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 @@ SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) { // 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 c8de73cd89..fc57e94f89 100644 --- a/src/codec/SkCodec.cpp +++ b/src/codec/SkCodec.cpp @@ -88,19 +88,19 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream, // 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 56d20e927c..2233c66c19 100644 --- a/src/codec/SkGifCodec.cpp +++ b/src/codec/SkGifCodec.cpp @@ -216,12 +216,12 @@ bool SkGifCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, GifFileType** // 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 dc4222a43c..d74c150ff5 100644 --- a/src/codec/SkIcoCodec.cpp +++ b/src/codec/SkIcoCodec.cpp @@ -140,9 +140,9 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { // 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 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { // 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 f1b55df06e..2534a5f123 100644 --- a/src/codec/SkJpegCodec.cpp +++ b/src/codec/SkJpegCodec.cpp @@ -55,10 +55,10 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, // 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 @@ SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) { 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 317defb368..326b9c23c6 100644 --- a/src/codec/SkPngCodec.cpp +++ b/src/codec/SkPngCodec.cpp @@ -75,7 +75,7 @@ public: fInfo_ptr = info_ptr; } - void detach() { + void release() { fPng_ptr = nullptr; fInfo_ptr = nullptr; } @@ -414,7 +414,7 @@ static bool read_header(SkStream* stream, SkPngChunkReader* chunkReader, 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 @@ SkCodec* SkPngCodec::NewFromStream(SkStream* stream, SkPngChunkReader* chunkRead 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 706d5ddd46..90ee322b1f 100644 --- a/src/codec/SkWbmpCodec.cpp +++ b/src/codec/SkWbmpCodec.cpp @@ -168,7 +168,7 @@ SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { } 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 6cfb385294..a795fdd6d5 100644 --- a/src/codec/SkWebpCodec.cpp +++ b/src/codec/SkWebpCodec.cpp @@ -77,7 +77,7 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) { 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 406a759696..b5b49e3ac5 100644 --- a/src/core/SkAdvancedTypefaceMetrics.cpp +++ b/src/core/SkAdvancedTypefaceMetrics.cpp @@ -250,7 +250,7 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData( 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 5a2180fade..92655d21b2 100644 --- a/src/core/SkAdvancedTypefaceMetrics.h +++ b/src/core/SkAdvancedTypefaceMetrics.h @@ -35,7 +35,7 @@ public: } } 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 8e889d44c4..d11ef78b1a 100644 --- a/src/core/SkColorTable.cpp +++ b/src/core/SkColorTable.cpp @@ -107,6 +107,6 @@ SkColorTable* SkColorTable::Create(SkReadBuffer& buffer) { 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 095ecce60a..cfdc571570 100644 --- a/src/core/SkFontDescriptor.h +++ b/src/core/SkFontDescriptor.h @@ -34,7 +34,7 @@ public: } 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 @@ public: 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 e9b7f6a82a..12c09cbe0a 100644 --- a/src/core/SkImageCacherator.cpp +++ b/src/core/SkImageCacherator.cpp @@ -55,7 +55,7 @@ SkImageCacherator* SkImageCacherator::NewFromGenerator(SkImageGenerator* gen, // 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 f87db31edb..e918f3b05f 100644 --- a/src/core/SkLightingShader.h +++ b/src/core/SkLightingShader.h @@ -38,7 +38,7 @@ public: } const Lights* finish() { - return fLights.detach(); + return fLights.release(); } private: diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp index 0ba28b97e3..a27c31a297 100644 --- a/src/core/SkPictureData.cpp +++ b/src/core/SkPictureData.cpp @@ -559,7 +559,7 @@ SkPictureData* SkPictureData::CreateFromStream(SkStream* stream, if (!data->parseStream(stream, proc, topLevelTFPlayback)) { return nullptr; } - return data.detach(); + return data.release(); } SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer, @@ -570,7 +570,7 @@ SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer, 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 62fa0e968f..8fbfed0229 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -92,8 +92,8 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() { 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 @@ protected: // 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 f9fd8bb374..4e23da20cc 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -27,7 +27,7 @@ SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() { 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 7372e540e7..44fb839d59 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -48,7 +48,7 @@ public: 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 5e6fe683f6..fa3cb9dbe0 100644 --- a/src/core/SkResourceCache.cpp +++ b/src/core/SkResourceCache.cpp @@ -279,7 +279,7 @@ void SkResourceCache::remove(Rec* rec) { size_t used = rec->bytesUsed(); SkASSERT(used <= fTotalBytesUsed); - this->detach(rec); + this->release(rec); fHash->remove(rec->getKey()); fTotalBytesUsed -= used; @@ -395,7 +395,7 @@ SkCachedData* SkResourceCache::newCachedData(size_t bytes) { /////////////////////////////////////////////////////////////////////////////// -void SkResourceCache::detach(Rec* rec) { +void SkResourceCache::release(Rec* rec) { Rec* prev = rec->fPrev; Rec* next = rec->fNext; @@ -425,7 +425,7 @@ void SkResourceCache::moveToHead(Rec* rec) { 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 548f17fe87..a8da4bd58b 100644 --- a/src/core/SkResourceCache.h +++ b/src/core/SkResourceCache.h @@ -276,7 +276,7 @@ private: // 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 b6d0a2bb33..a4c44fb2bc 100644 --- a/src/core/SkStream.cpp +++ b/src/core/SkStream.cpp @@ -241,7 +241,7 @@ SkStreamAsset* SkFILEStream::duplicate() const { 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 @@ bool SkFILEStream::move(long offset) { 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 @@ bool SkMemoryStream::move(long offset) { 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 @@ public: 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 7f6536cc8a..79fe858aac 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp @@ -624,7 +624,7 @@ const SkTextBlob* SkTextBlobBuilder::build() { 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 8d4233eac1..8b7620b484 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -232,7 +232,7 @@ SkFontData* SkTypeface::createFontData() const { 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 acee70ff25..4d05353f1a 100644 --- a/src/effects/SkBlurMask.cpp +++ b/src/effects/SkBlurMask.cpp @@ -600,7 +600,7 @@ bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, 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 @@ bool SkBlurMask::BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src, 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 24e7f5816b..cba103be36 100644 --- a/src/effects/gradients/SkGradientBitmapCache.cpp +++ b/src/effects/gradients/SkGradientBitmapCache.cpp @@ -51,7 +51,7 @@ SkGradientBitmapCache::~SkGradientBitmapCache() { } } -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 @@ bool SkGradientBitmapCache::find(const void* buffer, size_t size, SkBitmap* bm) *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 @@ void SkGradientBitmapCache::add(const void* buffer, size_t len, const SkBitmap& 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 009b9561a7..81bd214fe0 100644 --- a/src/effects/gradients/SkGradientBitmapCache.h +++ b/src/effects/gradients/SkGradientBitmapCache.h @@ -28,7 +28,7 @@ private: 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 de309d311b..50af9b4c40 100644 --- a/src/fonts/SkFontMgr_fontconfig.cpp +++ b/src/fonts/SkFontMgr_fontconfig.cpp @@ -309,13 +309,13 @@ protected: 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 2470f8a693..fc0bd5c7ce 100644 --- a/src/fonts/SkFontMgr_indirect.cpp +++ b/src/fonts/SkFontMgr_indirect.cpp @@ -125,7 +125,7 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i 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 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i 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 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i 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 @@ SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[], face.reset(this->createTypefaceFromFontId(fontId)); } - return face.detach(); + return face.release(); } diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index f56a4e44bd..e04adee90d 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -713,7 +713,7 @@ GrTexture* GrClipMaskManager::CreateAlphaClipMask(GrContext* context, } } - return texture.detach(); + return texture.release(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp index b7e48254c8..bcf0c32cf5 100755 --- a/src/gpu/GrContextFactory.cpp +++ b/src/gpu/GrContextFactory.cpp @@ -143,7 +143,7 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ } 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 afeeda7ae6..512ce9b687 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -477,7 +477,7 @@ const GrGpu::MultisampleSpecs& GrGpu::getMultisampleSpecs(GrRenderTarget* rt, 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 7affae6561..429a63affa 100644 --- a/src/gpu/GrTextureParamsAdjuster.cpp +++ b/src/gpu/GrTextureParamsAdjuster.cpp @@ -119,7 +119,7 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset, 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 708cbecb11..f35c6dfe9b 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -141,6 +141,6 @@ GrTexture* GrYUVProvider::refAsTexture(GrContext* ctx, const GrSurfaceDesc& desc 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 7a6d967538..173fe30e43 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -335,7 +335,7 @@ void SkGpuDevice::replaceRenderTarget(bool shouldRetainContent) { 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 a99f4ebf43..b11585861c 100644 --- a/src/gpu/batches/GrDrawPathBatch.cpp +++ b/src/gpu/batches/GrDrawPathBatch.cpp @@ -99,7 +99,7 @@ bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { 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 ada6dbf963..cf431732fd 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -60,7 +60,7 @@ static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const SkPath& s } 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 1ddc101cfc..43a147d763 100644 --- a/src/gpu/gl/GrGLExtensions.cpp +++ b/src/gpu/gl/GrGLExtensions.cpp @@ -125,7 +125,7 @@ bool GrGLExtensions::remove(const char ext[]) { 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 01f827c8fa..ebe5032827 100644 --- a/src/gpu/gl/SkGLContext.cpp +++ b/src/gpu/gl/SkGLContext.cpp @@ -140,7 +140,7 @@ SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGL 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 2c9f38e1d9..0e37a7e1f6 100644 --- a/src/gpu/gl/angle/SkANGLEGLContext.cpp +++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp @@ -123,7 +123,7 @@ SkANGLEGLContext::SkANGLEGLContext(bool useGLBackend) 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 cf9da9365b..b14debda57 100644 --- a/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp +++ b/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp @@ -259,7 +259,7 @@ void SkCommandBufferGLContext::initializeGLContext(void* nativeWindow, const int 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 bf939730ca..09b7323877 100644 --- a/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp +++ b/src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp @@ -179,7 +179,7 @@ EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI) 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 51b8ce9e60..b91262f4ef 100644 --- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp +++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp @@ -284,7 +284,7 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareContext 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 5be351f52e..54dc59af03 100644 --- a/src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm +++ b/src/gpu/gl/iOS/SkCreatePlatformGLContext_iOS.mm @@ -53,7 +53,7 @@ IOSGLContext::IOSGLContext() "/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 d1826a49e3..c6eb34b8df 100644 --- a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp +++ b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp @@ -77,7 +77,7 @@ MacGLContext::MacGLContext() "/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 541b247fa8..8b3666c497 100644 --- a/src/gpu/gl/mesa/SkMesaGLContext.cpp +++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp @@ -63,7 +63,7 @@ SkMesaGLContext::SkMesaGLContext() 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 6cc11439bf..da13ee739e 100644 --- a/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp +++ b/src/gpu/gl/win/SkCreatePlatformGLContext_win.cpp @@ -127,7 +127,7 @@ WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI) return; } - this->init(gl.detach()); + this->init(gl.release()); } WinGLContext::~WinGLContext() { diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 8a78f4558b..1970c57839 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -134,7 +134,7 @@ SkData* SkImage::encode(SkPixelSerializer* serializer) const { } 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 0cb0e02c27..ba4a50ff82 100644 --- a/src/lazy/SkDiscardablePixelRef.cpp +++ b/src/lazy/SkDiscardablePixelRef.cpp @@ -137,7 +137,7 @@ bool SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator* generator, const 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 5687dd415f..c0147bcfd9 100755 --- a/src/pathops/SkOpCoincidence.cpp +++ b/src/pathops/SkOpCoincidence.cpp @@ -481,7 +481,7 @@ bool SkOpCoincidence::apply() { return true; } -void SkOpCoincidence::detach(SkCoincidentSpans* remove) { +void SkOpCoincidence::release(SkCoincidentSpans* remove) { SkCoincidentSpans* coin = fHead; SkCoincidentSpans* prev = nullptr; SkCoincidentSpans* next; @@ -604,28 +604,28 @@ void SkOpCoincidence::fixUp(SkOpPtT* deleted, SkOpPtT* kept) { 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 91da2e16bf..96bd21ac48 100644 --- a/src/pathops/SkOpCoincidence.h +++ b/src/pathops/SkOpCoincidence.h @@ -79,7 +79,7 @@ public: 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 2ba7d79b30..24f76aa6de 100644 --- a/src/pathops/SkOpSegment.cpp +++ b/src/pathops/SkOpSegment.cpp @@ -571,7 +571,7 @@ int SkOpSegment::computeSum(SkOpSpanBase* start, SkOpSpanBase* end, 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 @@ void SkOpSegment::moveNearby() { 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 40a50c5fe0..2a51d349fe 100644 --- a/src/pathops/SkOpSegment.h +++ b/src/pathops/SkOpSegment.h @@ -173,7 +173,7 @@ public: 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 7c98e1dcc6..f3362235d8 100755 --- a/src/pathops/SkOpSpan.cpp +++ b/src/pathops/SkOpSpan.cpp @@ -138,7 +138,7 @@ void SkOpPtT::removeNext(SkOpPtT* kept) { SkOpSpanBase* span = next->span(); next->setDeleted(); if (span->ptT() == next) { - span->upCast()->detach(kept); + span->upCast()->release(kept); } } @@ -293,7 +293,7 @@ void SkOpSpanBase::merge(SkOpSpan* span) { 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 @@ bool SkOpSpan::containsCoincidence(const SkOpSegment* segment) const { return false; } -void SkOpSpan::detach(SkOpPtT* kept) { +void SkOpSpan::release(SkOpPtT* kept) { SkASSERT(!final()); SkOpSpan* prev = this->prev(); SkASSERT(prev); @@ -342,7 +342,7 @@ void SkOpSpan::detach(SkOpPtT* kept) { 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 e512554cc6..c6fc4b138f 100644 --- a/src/pathops/SkOpSpan.h +++ b/src/pathops/SkOpSpan.h @@ -404,7 +404,7 @@ public: } 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 86d4d07acb..94a103aeb1 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -595,9 +595,9 @@ struct ContentEntry { // 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 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack, 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 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode, // 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 bacd9eccc7..4895dc5a74 100644 --- a/src/pdf/SkPDFDocument.cpp +++ b/src/pdf/SkPDFDocument.cpp @@ -399,6 +399,6 @@ SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) { 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 59bfc8f3f1..ac9843370f 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -267,7 +267,7 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen, 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 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth, 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 2ae3217585..f5e5b1e439 100644 --- a/src/pdf/SkPDFShader.cpp +++ b/src/pdf/SkPDFShader.cpp @@ -622,7 +622,7 @@ SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create( 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 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create( 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 @@ SkPDFImageShader* SkPDFImageShader::Create( // 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 b8f2e4e92b..8b8f323db6 100644 --- a/src/pdf/SkPDFStream.cpp +++ b/src/pdf/SkPDFStream.cpp @@ -45,7 +45,7 @@ void SkPDFStream::setData(SkStream* stream) { 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 f1724b675b..69f660c8f1 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -105,7 +105,7 @@ public: } } - CFRef detach() { + CFRef release() { CFRef self = fCFRef; fCFRef = nullptr; return self; @@ -550,7 +550,7 @@ static SkTypeface* NewFromName(const char familyName[], const SkFontStyle& theSt 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 @@ SkFontData* SkTypeface_Mac::onCreateFontData() const { 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 @@ static SkTypeface* createFromDesc(CFStringRef cfFamilyName, CTFontDescriptorRef 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 @@ protected: 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 @@ protected: 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 93a7d8659f..ead0bf0b83 100644 --- a/src/ports/SkFontMgr_android.cpp +++ b/src/ports/SkFontMgr_android.cpp @@ -388,7 +388,7 @@ protected: uint16_t glyphID; paint.textToGlyphs(&character, sizeof(character), &glyphID); if (glyphID != 0) { - return face.detach(); + return face.release(); } } return nullptr; @@ -438,7 +438,7 @@ protected: 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 @@ protected: 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 @@ protected: 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 3f9c90cf31..dbc1dee92e 100644 --- a/src/ports/SkFontMgr_android_parser.cpp +++ b/src/ports/SkFontMgr_android_parser.cpp @@ -273,7 +273,7 @@ static const TagHandler familyHandler = { } }, /*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 @@ static const TagHandler familyHandler = { } }, /*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 7f3ce6b032..158ba006d4 100644 --- a/src/ports/SkFontMgr_custom.cpp +++ b/src/ports/SkFontMgr_custom.cpp @@ -296,7 +296,7 @@ protected: 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 @@ protected: 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 @@ private: 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 bd6a5a2a2a..089be5cdbe 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -196,8 +196,8 @@ static SkWeakReturn is_weak(FcPattern* pattern, const char object[], int id) { 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 @@ protected: } } - return new StyleSet(this, matches.detach()); + return new StyleSet(this, matches.release()); } virtual SkTypeface* onMatchFamilyStyle(const char familyName[], @@ -830,7 +830,7 @@ protected: 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 @@ protected: 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 @@ protected: : 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 a3474a1c78..9be0b8c6f2 100644 --- a/src/ports/SkImageGeneratorCG.cpp +++ b/src/ports/SkImageGeneratorCG.cpp @@ -66,7 +66,7 @@ SkImageGenerator* SkImageGeneratorCG::NewFromEncodedCG(SkData* data) { // 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 d200173315..cdf186c925 100644 --- a/src/ports/SkRemotableFontMgr_win_dw.cpp +++ b/src/ports/SkRemotableFontMgr_win_dw.cpp @@ -172,7 +172,7 @@ public: 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 683d750bda..cb533ff3f2 100644 --- a/src/sfnt/SkOTUtils.cpp +++ b/src/sfnt/SkOTUtils.cpp @@ -174,7 +174,7 @@ SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(const SkTypeface& ty 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 669a6c2188..2c34d360d6 100644 --- a/src/utils/SkCanvasStateUtils.cpp +++ b/src/utils/SkCanvasStateUtils.cpp @@ -260,7 +260,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) { canvasState->layers = (SkCanvasLayerState*) sk_malloc_throw(layerWriter.bytesWritten()); layerWriter.flatten(canvasState->layers); - return canvasState.detach(); + return canvasState.release(); } //////////////////////////////////////////////////////////////////////////////// @@ -311,7 +311,7 @@ static SkCanvas* create_canvas_from_canvas_layer(const SkCanvasLayerState& layer // 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 @@ SkCanvas* SkCanvasStateUtils::CreateFromCanvasState(const SkCanvasState* state) state_v1->layers[i].y)); } - return canvas.detach(); + return canvas.release(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp index a0dbeb6a7a..2dfb8ab882 100644 --- a/src/utils/SkFrontBufferedStream.cpp +++ b/src/utils/SkFrontBufferedStream.cpp @@ -147,7 +147,7 @@ size_t FrontBufferedStream::readDirectlyFromStream(char* dst, size_t size) { // 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 d4bf8a2023..460f90e6c4 100644 --- a/src/utils/win/SkDWriteFontFileStream.cpp +++ b/src/utils/win/SkDWriteFontFileStream.cpp @@ -107,7 +107,7 @@ bool SkDWriteFontFileStream::move(long offset) { 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 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment( } *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 04a219b6a7..2a74ed6b2c 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 @@ bool SkOSWindow::attach(SkBackEndTypes /* attachType */, 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 9dbbe5bfc2..ee5372113d 100644 --- a/src/views/mac/SkOSWindow_Mac.mm +++ b/src/views/mac/SkOSWindow_Mac.mm @@ -69,7 +69,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, int sampleCount, AttachmentIn 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 c39a4fdfef..76d43498e8 100644 --- a/src/views/sdl/SkOSWindow_SDL.cpp +++ b/src/views/sdl/SkOSWindow_SDL.cpp @@ -50,7 +50,7 @@ SkOSWindow* SkOSWindow::GetInstanceForWindowID(Uint32 windowID) { return nullptr; } -void SkOSWindow::detach() { +void SkOSWindow::release() { if (fGLContext) { SDL_GL_DeleteContext(fGLContext); fGLContext = nullptr; @@ -76,7 +76,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, Attachme 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::createWindow(int msaaSampleCount) { } 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 1c288f4be8..7833bbe2c0 100644 --- a/src/views/unix/SkOSWindow_Unix.cpp +++ b/src/views/unix/SkOSWindow_Unix.cpp @@ -47,7 +47,7 @@ SkOSWindow::~SkOSWindow() { 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 @@ bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* inf 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 c451708cef..ee851a104f 100644 --- a/src/views/win/SkOSWindow_win.cpp +++ b/src/views/win/SkOSWindow_win.cpp @@ -636,7 +636,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount, Attachme 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 0e241d9aaa..33edf789e4 100644 --- a/src/xps/SkDocument_XPS.cpp +++ b/src/xps/SkDocument_XPS.cpp @@ -76,7 +76,7 @@ SkDocument* SkDocument::CreateXPS(const char path[], SkScalar dpi) { 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 e4ac2aa742..5d12c499ed 100644 --- a/src/xps/SkXPSDevice.cpp +++ b/src/xps/SkXPSDevice.cpp @@ -420,10 +420,10 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) { } 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 c387e157be..5c01490f9b 100644 --- a/tests/BadIcoTest.cpp +++ b/tests/BadIcoTest.cpp @@ -31,7 +31,7 @@ DEF_TEST(BadImage, reporter) { 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 a0d71bbd70..fe6b412cd1 100644 --- a/tests/CachedDecodingPixelRefTest.cpp +++ b/tests/CachedDecodingPixelRefTest.cpp @@ -255,7 +255,7 @@ static void check_pixelref(TestImageGenerator::TestType type, 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 907fd7db9b..be25dc35b5 100644 --- a/tests/CodexTest.cpp +++ b/tests/CodexTest.cpp @@ -171,7 +171,7 @@ static void check(skiatest::Reporter* r, 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 @@ static void check(skiatest::Reporter* r, 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 @@ DEF_TEST(Codec_stripes, r) { 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 @@ static void test_dimensions(skiatest::Reporter* r, const char path[]) { 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 @@ static void test_invalid(skiatest::Reporter* r, const char path[]) { 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 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) { 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 @@ DEF_TEST(Codec_wbmp_max_size, r) { 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 @@ DEF_TEST(Codec_wbmp_max_size, r) { 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 555f41ec6a..3361aa3420 100644 --- a/tests/ColorSpaceTest.cpp +++ b/tests/ColorSpaceTest.cpp @@ -27,7 +27,7 @@ DEF_TEST(ColorSpaceParseICCProfile, r) { 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 f4cc5bf3a9..0b436552a3 100644 --- a/tests/FontHostStreamTest.cpp +++ b/tests/FontHostStreamTest.cpp @@ -98,7 +98,7 @@ DEF_TEST(FontHostStream, reporter) { 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 d2bb43ab3c..445f0bf4c9 100644 --- a/tests/FrontBufferedStreamTest.cpp +++ b/tests/FrontBufferedStreamTest.cpp @@ -285,5 +285,5 @@ DEF_TEST(ShortFrontBufferedStream, reporter) { // 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 caa0f6ffc9..7f02cc1c6a 100644 --- a/tests/GifTest.cpp +++ b/tests/GifTest.cpp @@ -198,7 +198,7 @@ DEF_TEST(Gif_Sampled, r) { 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 eb84b3c957..d6a88cf465 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -372,7 +372,7 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) { } 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 4dad52b50c..c431abc5c3 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -33,9 +33,9 @@ static void test_autounref(skiatest::Reporter* reporter) { 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 e1d8961205..f7b3306b98 100644 --- a/tests/YUVTest.cpp +++ b/tests/YUVTest.cpp @@ -25,7 +25,7 @@ static void codec_yuv(skiatest::Reporter* reporter, 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 62b3f9fd0d..ecbf88c17a 100644 --- a/tools/Resources.cpp +++ b/tools/Resources.cpp @@ -42,7 +42,7 @@ SkStreamAsset* GetResourceAsStream(const char* resource) { 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 @@ SkTypeface* GetResourceAsTypeface(const char* resource) { 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 6d0268a708..69d47b6b04 100644 --- a/tools/VisualBench/VisualBench.cpp +++ b/tools/VisualBench/VisualBench.cpp @@ -108,7 +108,7 @@ void VisualBench::setupContext() { 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 @@ void VisualBench::tearDownContext() { fContext.reset(); fSurface.reset(); fInterface.reset(); - this->detach(); + this->release(); } } diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp index 9fd2a29968..e0d02f2b97 100644 --- a/tools/VisualBench/VisualBenchmarkStream.cpp +++ b/tools/VisualBench/VisualBenchmarkStream.cpp @@ -168,7 +168,7 @@ Benchmark* VisualBenchmarkStream::innerNext() { 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 e342c4415e..2f5a875ac3 100644 --- a/tools/debugger/SkDrawCommand.cpp +++ b/tools/debugger/SkDrawCommand.cpp @@ -769,10 +769,10 @@ static SkBitmap* load_bitmap(const Json::Value& jsonBitmap, UrlDataManager& urlD 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; |