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

Unified Diff: src/gpu/GrGpuResourceRef.cpp

Issue 579403003: Move IOType to GrGpuRef and rename that to GrIORef. Template GrPendingIORef on IOType. (Closed) Base URL: https://skia.googlesource.com/skia.git@ref
Patch Set: rebase again 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/GrGpuResource.cpp ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpuResourceRef.cpp
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp
index e2a702ef6d575be2c3cad529f3e89e7efd98f2b3..7c521df462e8888b3257f922834d7a067f220313 100644
--- a/src/gpu/GrGpuResourceRef.cpp
+++ b/src/gpu/GrGpuResourceRef.cpp
@@ -6,16 +6,14 @@
*/
#include "GrGpuResourceRef.h"
-#include "GrGpuResource.h"
GrGpuResourceRef::GrGpuResourceRef() {
fResource = NULL;
fOwnRef = false;
fPendingIO = false;
- fIOType = kNone_IOType;
}
-GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, IOType ioType) {
+GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIORef::IOType ioType) {
fResource = NULL;
fOwnRef = false;
fPendingIO = false;
@@ -29,16 +27,13 @@ GrGpuResourceRef::~GrGpuResourceRef() {
}
if (fPendingIO) {
switch (fIOType) {
- case kNone_IOType:
- SkFAIL("Shouldn't get here if fIOType is kNone.");
- break;
- case kRead_IOType:
+ case GrIORef::kRead_IOType:
fResource->completedRead();
break;
- case kWrite_IOType:
+ case GrIORef::kWrite_IOType:
fResource->completedWrite();
break;
- case kRW_IOType:
+ case GrIORef::kRW_IOType:
fResource->completedRead();
fResource->completedWrite();
break;
@@ -53,20 +48,17 @@ void GrGpuResourceRef::reset() {
fResource->unref();
fOwnRef = false;
fResource = NULL;
- fIOType = kNone_IOType;
}
}
-void GrGpuResourceRef::setResource(GrGpuResource* resource, IOType ioType) {
+void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIORef::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;
@@ -80,16 +72,13 @@ void GrGpuResourceRef::markPendingIO() const {
SkASSERT(fResource);
fPendingIO = true;
switch (fIOType) {
- case kNone_IOType:
- SkFAIL("GrGpuResourceRef with neither reads nor writes?");
- break;
- case kRead_IOType:
+ case GrIORef::kRead_IOType:
fResource->addPendingRead();
break;
- case kWrite_IOType:
+ case GrIORef::kWrite_IOType:
fResource->addPendingWrite();
break;
- case kRW_IOType:
+ case GrIORef::kRW_IOType:
fResource->addPendingRead();
fResource->addPendingWrite();
break;
@@ -102,16 +91,13 @@ void GrGpuResourceRef::pendingIOComplete() const {
SkASSERT(fOwnRef);
SkASSERT(fPendingIO);
switch (fIOType) {
- case kNone_IOType:
- SkFAIL("GrGpuResourceRef with neither reads nor writes?");
- break;
- case kRead_IOType:
+ case GrIORef::kRead_IOType:
fResource->completedRead();
break;
- case kWrite_IOType:
+ case GrIORef::kWrite_IOType:
fResource->completedWrite();
break;
- case kRW_IOType:
+ case GrIORef::kRW_IOType:
fResource->completedRead();
fResource->completedWrite();
break;
@@ -125,7 +111,6 @@ void GrGpuResourceRef::removeRef() const {
// 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/GrGpuResource.cpp ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698