[go: nahoru, domu]

gfx: Improve handle management in gfx::GpuMemoryBuffer

The handle returned from gfx::GpuMemoryBuffer::GetHandle() is either passed to
CloneHandleForIPC immediately or used to obtain some handle metadata (type,
GUID).

This CL replaces GpuMemoryBuffer::GetHandle() with the new method
GpuMemoryBuffer::CloneHandle() that is equivalent of calling
CloneHandleForIPC(buffer.GetHandle()). This will allow to use scoped objects for
all types of underlying platform handles, since no two GpuMemoryBufferHandles
will refer to the same system resource. New methods are also added to access
type/GUID of buffer.

As a demonstration, this CL changes the type of the
GpuMemoryBufferHandle::android_hardware_buffer from AHardwareBuffer* to
base::android::ScopedHardwareBufferHandle.

Bug: 854594, 863011
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_layout_tests_slimming_paint_v2;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I0306f4295cf28113cf467dba3c2a2b1717ca2e67
Reviewed-on: https://chromium-review.googlesource.com/1126394
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Chrome Cunningham (In Paris) <chcunningham@chromium.org>
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Klaus Weidner <klausw@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576964}
60 files changed