Add tracing to GrContext resource cleanup

For https://github.com/flutter/flutter/issues/35296

The change is suggested by bsalomon@google.com

Change-Id: I70a2f5298b49d7a64e51cb1f364834e62dcaf4a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225119
Commit-Queue: Yuqian Li <liyuqian@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Yuqian Li <liyuqian@google.com>
This commit is contained in:
Yuqian Li 2019-07-02 13:45:00 -07:00 committed by Skia Commit-Bot
parent b2adbef6f6
commit 40aa85f589
4 changed files with 8 additions and 0 deletions

View File

@ -180,6 +180,8 @@ void GrContext::purgeUnlockedResources(bool scratchResourcesOnly) {
}
void GrContext::performDeferredCleanup(std::chrono::milliseconds msNotUsed) {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
ASSERT_SINGLE_OWNER
auto purgeTime = GrStdSteadyClock::now() - msNotUsed;

View File

@ -134,6 +134,8 @@ inline const GrGLCaps& GrGLBuffer::glCaps() const {
}
void GrGLBuffer::onRelease() {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
if (!this->wasDestroyed()) {
VALIDATE();
// make sure we've not been abandoned or already released

View File

@ -330,6 +330,8 @@ GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& origSkPath, const GrStyle& style)
}
void GrGLPath::onRelease() {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
if (0 != fPathID) {
static_cast<GrGLGpu*>(this->getGpu())->glPathRendering()->deletePaths(fPathID, 1);
fPathID = 0;

View File

@ -93,6 +93,8 @@ GrGLenum GrGLTexture::target() const {
}
void GrGLTexture::onRelease() {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
if (fID) {
if (GrBackendObjectOwnership::kBorrowed != fTextureIDOwnership) {
GL_CALL(DeleteTextures(1, &fID));