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

Unified Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 11419280: Make FencedAlloctor fail on size = 0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add separate zero allocation tracking Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/mapped_memory.cc
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index c8d400ec25dc8be835ea8f68c654a923cf6017dd..5898133c09ec3c3d559e905b5408411c0adc00f1 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -54,7 +54,7 @@ void* MappedMemoryManager::Alloc(
// Make a new chunk to satisfy the request.
CommandBuffer* cmd_buf = helper_->command_buffer();
unsigned int chunk_size =
- ((size + chunk_size_multiple_ - 1) / chunk_size_multiple_) *
+ ((std::max(1u, size) + chunk_size_multiple_ - 1) / chunk_size_multiple_) *
chunk_size_multiple_;
int32 id = cmd_buf->CreateTransferBuffer(chunk_size, -1);
if (id == -1) {

Powered by Google App Engine
This is Rietveld 408576698