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 <[email protected]>
Reviewed-by: danakj <[email protected]>
Reviewed-by: Daniele Castagna <[email protected]>
Reviewed-by: Chrome Cunningham (In Paris) <[email protected]>
Reviewed-by: Ricky Liang <[email protected]>
Reviewed-by: Kenneth Russell <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Antoine Labour <[email protected]>
Reviewed-by: Klaus Weidner <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#576964}
60 files changed