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

Side by Side Diff: src/gpu/GrAllocPool.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase 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 | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/GrAllocator.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 2010 Google Inc. 2 * Copyright 2010 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 #include "GrAllocPool.h" 8 #include "GrAllocPool.h"
9 9
10 #include "GrTypes.h" 10 #include "GrTypes.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 size_t blockSize = SkTMax(fMinBlockSize, size); 83 size_t blockSize = SkTMax(fMinBlockSize, size);
84 fBlock = Block::Create(blockSize, fBlock); 84 fBlock = Block::Create(blockSize, fBlock);
85 SkDEBUGCODE(fBlocksAllocated += 1;) 85 SkDEBUGCODE(fBlocksAllocated += 1;)
86 } 86 }
87 return fBlock->alloc(size); 87 return fBlock->alloc(size);
88 } 88 }
89 89
90 void GrAllocPool::release(size_t bytes) { 90 void GrAllocPool::release(size_t bytes) {
91 this->validate(); 91 this->validate();
92 92
93 while (bytes && NULL != fBlock) { 93 while (bytes && fBlock) {
94 bytes = fBlock->release(bytes); 94 bytes = fBlock->release(bytes);
95 if (fBlock->empty()) { 95 if (fBlock->empty()) {
96 Block* next = fBlock->fNext; 96 Block* next = fBlock->fNext;
97 sk_free(fBlock); 97 sk_free(fBlock);
98 fBlock = next; 98 fBlock = next;
99 SkDEBUGCODE(fBlocksAllocated -= 1;) 99 SkDEBUGCODE(fBlocksAllocated -= 1;)
100 } 100 }
101 } 101 }
102 } 102 }
103 103
104 #ifdef SK_DEBUG 104 #ifdef SK_DEBUG
105 105
106 void GrAllocPool::validate() const { 106 void GrAllocPool::validate() const {
107 Block* block = fBlock; 107 Block* block = fBlock;
108 int count = 0; 108 int count = 0;
109 while (block) { 109 while (block) {
110 count += 1; 110 count += 1;
111 block = block->fNext; 111 block = block->fNext;
112 } 112 }
113 SkASSERT(fBlocksAllocated == count); 113 SkASSERT(fBlocksAllocated == count);
114 } 114 }
115 115
116 #endif 116 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/GrAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698