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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGpuResourceRef_DEFINED 8 #ifndef GrGpuResourceRef_DEFINED
9 #define GrGpuResourceRef_DEFINED 9 #define GrGpuResourceRef_DEFINED
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 private: 152 private:
153 typedef GrGpuResourceRef INHERITED; 153 typedef GrGpuResourceRef INHERITED;
154 }; 154 };
155 155
156 /** 156 /**
157 * This is similar to GrTGpuResourceRef but can only be in the pending IO state. It never owns a 157 * This is similar to GrTGpuResourceRef but can only be in the pending IO state. It never owns a
158 * ref. 158 * ref.
159 */ 159 */
160 template <typename T, GrIOType IO_TYPE> class GrPendingIOResource : SkNoncopyabl e { 160 template <typename T, GrIOType IO_TYPE> class GrPendingIOResource : SkNoncopyabl e {
161 public: 161 public:
162 GrPendingIOResource(T* resource) : fResource(resource) { 162 GrPendingIOResource(T* resource = NULL) {
163 if (NULL != fResource) { 163 this->set(resource);
164 }
165
166 void set(T* resource) {
bsalomon 2014/11/18 20:48:31 Shouldn't this check whether the resource was alre
167 fResource = resource;
168 if (NULL != resource) {
164 switch (IO_TYPE) { 169 switch (IO_TYPE) {
165 case kRead_GrIOType: 170 case kRead_GrIOType:
166 fResource->addPendingRead(); 171 resource->addPendingRead();
167 break; 172 break;
168 case kWrite_GrIOType: 173 case kWrite_GrIOType:
169 fResource->addPendingWrite(); 174 resource->addPendingWrite();
170 break; 175 break;
171 case kRW_GrIOType: 176 case kRW_GrIOType:
172 fResource->addPendingRead(); 177 resource->addPendingRead();
173 fResource->addPendingWrite(); 178 resource->addPendingWrite();
174 break; 179 break;
175 } 180 }
176 } 181 }
177 } 182 }
178 183
179 ~GrPendingIOResource() { 184 ~GrPendingIOResource() {
180 if (NULL != fResource) { 185 if (NULL != fResource) {
181 switch (IO_TYPE) { 186 switch (IO_TYPE) {
182 case kRead_GrIOType: 187 case kRead_GrIOType:
183 fResource->completedRead(); 188 fResource->completedRead();
184 break; 189 break;
185 case kWrite_GrIOType: 190 case kWrite_GrIOType:
186 fResource->completedWrite(); 191 fResource->completedWrite();
187 break; 192 break;
188 case kRW_GrIOType: 193 case kRW_GrIOType:
189 fResource->completedRead(); 194 fResource->completedRead();
190 fResource->completedWrite(); 195 fResource->completedWrite();
191 break; 196 break;
192 } 197 }
193 } 198 }
194 } 199 }
195 200
196 T* get() const { return fResource; } 201 T* get() const { return fResource; }
197 202
198 private: 203 private:
199 T* fResource; 204 T* fResource;
200 }; 205 };
201 #endif 206 #endif
OLDNEW
« 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