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

Side by Side Diff: src/lazy/SkDiscardableMemoryPool.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 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/lazy/SkCachingPixelRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.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 2013 Google Inc. 2 * Copyright 2013 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 "SkDiscardableMemory.h" 8 #include "SkDiscardableMemory.h"
9 #include "SkDiscardableMemoryPool.h" 9 #include "SkDiscardableMemoryPool.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 cur = iter.prev(); 171 cur = iter.prev();
172 } 172 }
173 } 173 }
174 } 174 }
175 175
176 SkDiscardableMemory* DiscardableMemoryPool::create(size_t bytes) { 176 SkDiscardableMemory* DiscardableMemoryPool::create(size_t bytes) {
177 void* addr = sk_malloc_flags(bytes, 0); 177 void* addr = sk_malloc_flags(bytes, 0);
178 if (NULL == addr) { 178 if (NULL == addr) {
179 return NULL; 179 return NULL;
180 } 180 }
181 PoolDiscardableMemory* dm = SkNEW_ARGS(PoolDiscardableMemory, 181 PoolDiscardableMemory* dm = new PoolDiscardableMemory(this, addr, bytes);
182 (this, addr, bytes));
183 SkAutoMutexAcquire autoMutexAcquire(fMutex); 182 SkAutoMutexAcquire autoMutexAcquire(fMutex);
184 fList.addToHead(dm); 183 fList.addToHead(dm);
185 fUsed += bytes; 184 fUsed += bytes;
186 this->dumpDownTo(fBudget); 185 this->dumpDownTo(fBudget);
187 return dm; 186 return dm;
188 } 187 }
189 188
190 void DiscardableMemoryPool::free(PoolDiscardableMemory* dm) { 189 void DiscardableMemoryPool::free(PoolDiscardableMemory* dm) {
191 SkAutoMutexAcquire autoMutexAcquire(fMutex); 190 SkAutoMutexAcquire autoMutexAcquire(fMutex);
192 // This is called by dm's destructor. 191 // This is called by dm's destructor.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 //////////////////////////////////////////////////////////////////////////////// 249 ////////////////////////////////////////////////////////////////////////////////
251 SK_DECLARE_STATIC_MUTEX(gMutex); 250 SK_DECLARE_STATIC_MUTEX(gMutex);
252 SkDiscardableMemoryPool* create_global_pool() { 251 SkDiscardableMemoryPool* create_global_pool() {
253 return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_ POOL_SIZE, 252 return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_ POOL_SIZE,
254 &gMutex); 253 &gMutex);
255 } 254 }
256 255
257 } // namespace 256 } // namespace
258 257
259 SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkBaseMute x* mutex) { 258 SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkBaseMute x* mutex) {
260 return SkNEW_ARGS(DiscardableMemoryPool, (size, mutex)); 259 return new DiscardableMemoryPool(size, mutex);
261 } 260 }
262 261
263 SK_DECLARE_STATIC_LAZY_PTR(SkDiscardableMemoryPool, global, create_global_pool); 262 SK_DECLARE_STATIC_LAZY_PTR(SkDiscardableMemoryPool, global, create_global_pool);
264 263
265 SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() { 264 SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() {
266 return global.get(); 265 return global.get();
267 } 266 }
268 267
269 //////////////////////////////////////////////////////////////////////////////// 268 ////////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/lazy/SkCachingPixelRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698