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

Side by Side Diff: src/core/SkTDPQueue.h

Issue 921323002: Make GrResourceCache use a priority queue of purgeable resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 5 years, 10 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 | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrGpuResource.cpp » ('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 2015 Google Inc. 2 * Copyright 2015 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 SkTDPQueue_DEFINED 8 #ifndef SkTDPQueue_DEFINED
9 #define SkTDPQueue_DEFINED 9 #define SkTDPQueue_DEFINED
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 allowed if an INDEX function is provided. */ 85 allowed if an INDEX function is provided. */
86 void priorityDidChange(T entry) { 86 void priorityDidChange(T entry) {
87 SkASSERT(NULL != INDEX); 87 SkASSERT(NULL != INDEX);
88 int index = *INDEX(entry); 88 int index = *INDEX(entry);
89 SkASSERT(index >= 0 && index < fArray.count()); 89 SkASSERT(index >= 0 && index < fArray.count());
90 this->validate(index); 90 this->validate(index);
91 this->percolateUpOrDown(index); 91 this->percolateUpOrDown(index);
92 this->validate(); 92 this->validate();
93 } 93 }
94 94
95 #ifdef SK_DEBUG
96 T at(int i) const { return fArray[i]; }
97 #endif
98
95 private: 99 private:
96 static int LeftOf(int x) { SkASSERT(x >= 0); return 2 * x + 1; } 100 static int LeftOf(int x) { SkASSERT(x >= 0); return 2 * x + 1; }
97 static int ParentOf(int x) { SkASSERT(x > 0); return (x - 1) >> 1; } 101 static int ParentOf(int x) { SkASSERT(x > 0); return (x - 1) >> 1; }
98 102
99 void percolateUpOrDown(int index) { 103 void percolateUpOrDown(int index) {
100 SkASSERT(index >= 0); 104 SkASSERT(index >= 0);
101 if (!percolateUpIfNecessary(index)) { 105 if (!percolateUpIfNecessary(index)) {
102 this->validate(index); 106 this->validate(index);
103 this->percolateDownIfNecessary(index); 107 this->percolateDownIfNecessary(index);
104 } 108 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 186 }
183 #endif 187 #endif
184 } 188 }
185 189
186 SkTDArray<T> fArray; 190 SkTDArray<T> fArray;
187 191
188 typedef SkNoncopyable INHERITED; 192 typedef SkNoncopyable INHERITED;
189 }; 193 };
190 194
191 #endif 195 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrGpuResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698