Commit b4f77515 authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

Update CommandBufferProxyImpl to mojo shm creation

This changes CommandBufferProxyImpl::AllocateAndMapSharedMemory
to use the new mojo shared memory region API for creating the
unsafe shared memory region it uses.

Bug: 872778
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ia1b5380eb21afe54a05e81d26df8307819de23c0
Reviewed-on: https://chromium-review.googlesource.com/1171229Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarAlexandr Ilin <alexilin@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590313}
parent d100b46b
......@@ -29,6 +29,7 @@
#include "gpu/ipc/common/command_buffer_id.h"
#include "gpu/ipc/common/gpu_messages.h"
#include "gpu/ipc/common/gpu_param_traits.h"
#include "mojo/public/cpp/base/shared_memory_utils.h"
#include "mojo/public/cpp/system/buffer.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/geometry/size.h"
......@@ -698,20 +699,10 @@ bool CommandBufferProxyImpl::Send(IPC::Message* msg) {
std::pair<base::UnsafeSharedMemoryRegion, base::WritableSharedMemoryMapping>
CommandBufferProxyImpl::AllocateAndMapSharedMemory(size_t size) {
mojo::ScopedSharedBufferHandle handle =
mojo::SharedBufferHandle::Create(size);
if (!handle.is_valid()) {
DLOG(ERROR) << "AllocateAndMapSharedMemory: Create failed";
return {};
}
// Mojo creates a handle with Writable mode, it needs to be converted to
// Unsafe.
base::UnsafeSharedMemoryRegion region =
base::WritableSharedMemoryRegion::ConvertToUnsafe(
mojo::UnwrapWritableSharedMemoryRegion(std::move(handle)));
mojo::CreateUnsafeSharedMemoryRegion(size);
if (!region.IsValid()) {
DLOG(ERROR) << "AllocateAndMapSharedMemory: Unwrap failed";
DLOG(ERROR) << "AllocateAndMapSharedMemory: Allocation failed";
return {};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment