This patch adds functionality to RingBuffer and TransferBuffer to shrink the last allocated block.
As a part of serializing PaintOpBuffers and doing raster in the gpu process, it's not known ahead of time how big the resulting serialization is going to be in memory. It's more convenient to be able to ask for whatever's free, serialize what it can, and shrink it if it didn't need to use all of it.
Bug: 671433 Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Change-Id: Iae1f36fb93fea1a29126123a16ca95e768b61d6d Reviewed-on: https://chromium-review.googlesource.com/602592
e2c118d Add ability to shrink TransferBuffer allocations
.../client/gles2_implementation_unittest.cc | 3 +++
gpu/command_buffer/client/ring_buffer.cc | 14 ++++++++++
gpu/command_buffer/client/ring_buffer.h | 3 +++
gpu/command_buffer/client/transfer_buffer.cc | 11 ++++++++
gpu/command_buffer/client/transfer_buffer.h | 6 +++++
.../client/transfer_buffer_unittest.cc | 30 ++++++++++++++++++++++
6 files changed, 67 insertions(+)