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

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

Issue 2152753002: GrBufferAllocPool: use _throw calloc() if unchecked. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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 8
9 #include "GrBufferAllocPool.h" 9 #include "GrBufferAllocPool.h"
10 #include "GrBuffer.h" 10 #include "GrBuffer.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 SkASSERT(!block.fBuffer->isMapped()); 274 SkASSERT(!block.fBuffer->isMapped());
275 block.fBuffer->unref(); 275 block.fBuffer->unref();
276 fBlocks.pop_back(); 276 fBlocks.pop_back();
277 fBufferPtr = nullptr; 277 fBufferPtr = nullptr;
278 } 278 }
279 279
280 void* GrBufferAllocPool::resetCpuData(size_t newSize) { 280 void* GrBufferAllocPool::resetCpuData(size_t newSize) {
281 sk_free(fCpuData); 281 sk_free(fCpuData);
282 if (newSize) { 282 if (newSize) {
283 if (fGpu->caps()->mustClearUploadedBufferData()) { 283 if (fGpu->caps()->mustClearUploadedBufferData()) {
284 fCpuData = sk_calloc(newSize); 284 fCpuData = sk_calloc_throw(newSize);
285 } else { 285 } else {
286 fCpuData = sk_malloc_throw(newSize); 286 fCpuData = sk_malloc_throw(newSize);
287 } 287 }
288 } else { 288 } else {
289 fCpuData = nullptr; 289 fCpuData = nullptr;
290 } 290 }
291 return fCpuData; 291 return fCpuData;
292 } 292 }
293 293
294 294
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 size_t offset = 0; // assign to suppress warning 365 size_t offset = 0; // assign to suppress warning
366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), 366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t),
367 sizeof(uint16_t), 367 sizeof(uint16_t),
368 buffer, 368 buffer,
369 &offset); 369 &offset);
370 370
371 SkASSERT(0 == offset % sizeof(uint16_t)); 371 SkASSERT(0 == offset % sizeof(uint16_t));
372 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); 372 *startIndex = static_cast<int>(offset / sizeof(uint16_t));
373 return ptr; 373 return ptr;
374 } 374 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698