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

Unified Diff: include/gpu/GrGpuResourceRef.h

Issue 737723003: drawinfo carries bufferinfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 years, 1 month 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 | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrGpuResourceRef.h
diff --git a/include/gpu/GrGpuResourceRef.h b/include/gpu/GrGpuResourceRef.h
index 93298f0656f4e5e03529c27e04e59233c0dba1bc..3742e2519519dfaafaf251ca38fe2a553a7e44fc 100644
--- a/include/gpu/GrGpuResourceRef.h
+++ b/include/gpu/GrGpuResourceRef.h
@@ -159,25 +159,38 @@ private:
*/
template <typename T, GrIOType IO_TYPE> class GrPendingIOResource : SkNoncopyable {
public:
- GrPendingIOResource(T* resource) : fResource(resource) {
- if (NULL != fResource) {
+ GrPendingIOResource(T* resource = NULL) : fResource(NULL) {
+ this->reset(resource);
+ }
+
+ void reset(T* resource) {
+ if (resource) {
switch (IO_TYPE) {
case kRead_GrIOType:
- fResource->addPendingRead();
+ resource->addPendingRead();
break;
case kWrite_GrIOType:
- fResource->addPendingWrite();
+ resource->addPendingWrite();
break;
case kRW_GrIOType:
- fResource->addPendingRead();
- fResource->addPendingWrite();
+ resource->addPendingRead();
+ resource->addPendingWrite();
break;
}
}
+ this->release();
+ fResource = resource;
}
~GrPendingIOResource() {
- if (NULL != fResource) {
+ this->release();
+ }
+
+ T* get() const { return fResource; }
+
+private:
+ void release() {
+ if (fResource) {
switch (IO_TYPE) {
case kRead_GrIOType:
fResource->completedRead();
@@ -193,9 +206,6 @@ public:
}
}
- T* get() const { return fResource; }
-
-private:
T* fResource;
};
#endif
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698