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

Side by Side Diff: include/gpu/GrGpuResource.h

Issue 594543004: Revert of Don't flush on read/write pixels unless necessary (Closed) Base URL: https://skia.googlesource.com/skia.git@iotype
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/GrSurface.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 GrGpuResource_DEFINED 8 #ifndef GrGpuResource_DEFINED
9 #define GrGpuResource_DEFINED 9 #define GrGpuResource_DEFINED
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 void validate() const { 74 void validate() const {
75 #ifdef SK_DEBUG 75 #ifdef SK_DEBUG
76 SkASSERT(fRefCnt >= 0); 76 SkASSERT(fRefCnt >= 0);
77 SkASSERT(fPendingReads >= 0); 77 SkASSERT(fPendingReads >= 0);
78 SkASSERT(fPendingWrites >= 0); 78 SkASSERT(fPendingWrites >= 0);
79 SkASSERT(fRefCnt + fPendingReads + fPendingWrites > 0); 79 SkASSERT(fRefCnt + fPendingReads + fPendingWrites > 0);
80 #endif 80 #endif
81 } 81 }
82 82
83
84 protected: 83 protected:
85 GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {} 84 GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {}
86 85
87 bool internalHasPendingRead() const { return SkToBool(fPendingReads); }
88 bool internalHasPendingWrite() const { return SkToBool(fPendingWrites); }
89 bool internalHasPendingIO() const { return SkToBool(fPendingWrites | fPendin gReads); }
90
91 private: 86 private:
92 void addPendingRead() const { 87 void addPendingRead() const {
93 this->validate(); 88 this->validate();
94 ++fPendingReads; 89 ++fPendingReads;
95 } 90 }
96 91
97 void completedRead() const { 92 void completedRead() const {
98 this->validate(); 93 this->validate();
99 --fPendingReads; 94 --fPendingReads;
100 if (0 == fRefCnt && 0 == fPendingReads && 0 == fPendingWrites) { 95 if (0 == fRefCnt && 0 == fPendingReads && 0 == fPendingWrites) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 245
251 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache 246 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
252 const uint32_t fUniqueID; 247 const uint32_t fUniqueID;
253 248
254 GrResourceKey fScratchKey; 249 GrResourceKey fScratchKey;
255 250
256 typedef GrIORef INHERITED; 251 typedef GrIORef INHERITED;
257 }; 252 };
258 253
259 #endif 254 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698