aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResourceRef.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-07-31 11:03:40 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 16:55:26 +0000
commitae5f9534b11915c6b927df2a681d2782d83a1b2f (patch)
tree77daaaaa525776ab690b002670105947688faf2f /src/gpu/GrGpuResourceRef.cpp
parent2f6791510574fe6ed62805f32c111dd29c68a782 (diff)
Remove unused GrGpuResourceRef and GrTGpuResourceRef
Change-Id: I8b4b323549f51e4601ccb6612f65d354e163e93c Reviewed-on: https://skia-review.googlesource.com/144504 Auto-Submit: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrGpuResourceRef.cpp')
-rw-r--r--src/gpu/GrGpuResourceRef.cpp127
1 files changed, 0 insertions, 127 deletions
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp
deleted file mode 100644
index 532e0655d8..0000000000
--- a/src/gpu/GrGpuResourceRef.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrGpuResourceRef.h"
-
-GrGpuResourceRef::GrGpuResourceRef() {
- fResource = nullptr;
- fOwnRef = false;
- fPendingIO = false;
-}
-
-GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIOType ioType) {
- fResource = nullptr;
- fOwnRef = false;
- fPendingIO = false;
- this->setResource(resource, ioType);
-}
-
-GrGpuResourceRef::~GrGpuResourceRef() {
- if (fOwnRef) {
- SkASSERT(fResource);
- fResource->unref();
- }
- if (fPendingIO) {
- switch (fIOType) {
- case kRead_GrIOType:
- fResource->completedRead();
- break;
- case kWrite_GrIOType:
- fResource->completedWrite();
- break;
- case kRW_GrIOType:
- fResource->completedRead();
- fResource->completedWrite();
- break;
- }
- }
-}
-
-void GrGpuResourceRef::reset() {
- SkASSERT(!fPendingIO);
- SkASSERT(SkToBool(fResource) == fOwnRef);
- if (fOwnRef) {
- fResource->unref();
- fOwnRef = false;
- fResource = nullptr;
- }
-}
-
-void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType) {
- SkASSERT(!fPendingIO);
- SkASSERT(SkToBool(fResource) == fOwnRef);
- SkSafeUnref(fResource);
- if (nullptr == resource) {
- fResource = nullptr;
- fOwnRef = false;
- } else {
- fResource = resource;
- fOwnRef = true;
- fIOType = ioType;
- }
-}
-
-void GrGpuResourceRef::markPendingIO() const {
- if (!fResource) {
- return;
- }
-
- // This should only be called when the owning GrProgramElement gets its first
- // pendingExecution ref.
- SkASSERT(!fPendingIO);
- fPendingIO = true;
- switch (fIOType) {
- case kRead_GrIOType:
- fResource->addPendingRead();
- break;
- case kWrite_GrIOType:
- fResource->addPendingWrite();
- break;
- case kRW_GrIOType:
- fResource->addPendingRead();
- fResource->addPendingWrite();
- break;
- }
-}
-
-void GrGpuResourceRef::pendingIOComplete() const {
- if (!fResource) {
- return;
- }
-
- // This should only be called when the owner's pending executions have ocurred but it is still
- // reffed.
- SkASSERT(fOwnRef);
- SkASSERT(fPendingIO);
- switch (fIOType) {
- case kRead_GrIOType:
- fResource->completedRead();
- break;
- case kWrite_GrIOType:
- fResource->completedWrite();
- break;
- case kRW_GrIOType:
- fResource->completedRead();
- fResource->completedWrite();
- break;
-
- }
- fPendingIO = false;
-}
-
-void GrGpuResourceRef::removeRef() const {
- if (!fResource) {
- return;
- }
-
- // This should only be called once, when the owners last ref goes away and
- // there is a pending execution.
- SkASSERT(fOwnRef);
- SkASSERT(fPendingIO);
- fResource->unref();
- fOwnRef = false;
-}