Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: src/gpu/GrProgramResource.cpp

Issue 574333003: Rename GrProgramResource to GrGpuResourceRef (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add newline before private: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrProgramElement.cpp ('k') | src/gpu/GrRODrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrProgramResource.cpp
diff --git a/src/gpu/GrProgramResource.cpp b/src/gpu/GrProgramResource.cpp
deleted file mode 100644
index 482caff7ee0b3257c04f827029abb2bcf40414a3..0000000000000000000000000000000000000000
--- a/src/gpu/GrProgramResource.cpp
+++ /dev/null
@@ -1,133 +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 "GrProgramResource.h"
-#include "GrGpuResource.h"
-
-GrProgramResource::GrProgramResource() {
- fResource = NULL;
- fOwnRef = false;
- fPendingIO = false;
- fIOType = kNone_IOType;
-}
-
-GrProgramResource::GrProgramResource(GrGpuResource* resource, IOType ioType) {
- fResource = NULL;
- fOwnRef = false;
- fPendingIO = false;
- this->setResource(resource, ioType);
-}
-
-GrProgramResource::~GrProgramResource() {
- if (fOwnRef) {
- SkASSERT(fResource);
- fResource->unref();
- }
- if (fPendingIO) {
- switch (fIOType) {
- case kNone_IOType:
- SkFAIL("Shouldn't get here if fIOType is kNone.");
- break;
- case kRead_IOType:
- fResource->completedRead();
- break;
- case kWrite_IOType:
- fResource->completedWrite();
- break;
- case kRW_IOType:
- fResource->completedRead();
- fResource->completedWrite();
- break;
- }
- }
-}
-
-void GrProgramResource::reset() {
- SkASSERT(!fPendingIO);
- SkASSERT(SkToBool(fResource) == fOwnRef);
- if (fOwnRef) {
- fResource->unref();
- fOwnRef = false;
- fResource = NULL;
- fIOType = kNone_IOType;
- }
-}
-
-void GrProgramResource::setResource(GrGpuResource* resource, IOType ioType) {
- SkASSERT(!fPendingIO);
- SkASSERT(SkToBool(fResource) == fOwnRef);
- SkSafeUnref(fResource);
- if (NULL == resource) {
- fResource = NULL;
- fOwnRef = false;
- fIOType = kNone_IOType;
- } else {
- SkASSERT(kNone_IOType != ioType);
- fResource = resource;
- fOwnRef = true;
- fIOType = ioType;
- }
-}
-
-void GrProgramResource::markPendingIO() const {
- // This should only be called when the owning GrProgramElement gets its first
- // pendingExecution ref.
- SkASSERT(!fPendingIO);
- SkASSERT(fResource);
- fPendingIO = true;
- switch (fIOType) {
- case kNone_IOType:
- SkFAIL("GrProgramResource with neither reads nor writes?");
- break;
- case kRead_IOType:
- fResource->addPendingRead();
- break;
- case kWrite_IOType:
- fResource->addPendingWrite();
- break;
- case kRW_IOType:
- fResource->addPendingRead();
- fResource->addPendingWrite();
- break;
-
- }
-}
-
-void GrProgramResource::pendingIOComplete() const {
- // 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 kNone_IOType:
- SkFAIL("GrProgramResource with neither reads nor writes?");
- break;
- case kRead_IOType:
- fResource->completedRead();
- break;
- case kWrite_IOType:
- fResource->completedWrite();
- break;
- case kRW_IOType:
- fResource->completedRead();
- fResource->completedWrite();
- break;
-
- }
- fPendingIO = false;
-}
-
-void GrProgramResource::removeRef() const {
- // This should only be called once, when the owners last ref goes away and
- // there is a pending execution.
- SkASSERT(fOwnRef);
- SkASSERT(fPendingIO);
- SkASSERT(kNone_IOType != fIOType);
- SkASSERT(fResource);
- fResource->unref();
- fOwnRef = false;
-}
« no previous file with comments | « src/gpu/GrProgramElement.cpp ('k') | src/gpu/GrRODrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698