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/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;