| Index: content/browser/renderer_host/shared_memory_allocator_impl.cc
|
| diff --git a/content/browser/renderer_host/shared_memory_allocator_impl.cc b/content/browser/renderer_host/shared_memory_allocator_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3636bc2dce80b40a46d3e1518c902c0ce24af68d
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/shared_memory_allocator_impl.cc
|
| @@ -0,0 +1,44 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/renderer_host/shared_memory_allocator_impl.h"
|
| +
|
| +#include "content/public/browser/browser_thread.h"
|
| +#include "mojo/public/cpp/bindings/strong_binding.h"
|
| +#include "mojo/public/cpp/system/platform_handle.h"
|
| +
|
| +namespace content {
|
| +
|
| +void SharedMemoryAllocatorImpl::Create(
|
| + mojom::SharedMemoryAllocatorRequest request) {
|
| + mojo::MakeStrongBinding(
|
| + base::WrapUnique(new SharedMemoryAllocatorImpl()),
|
| + std::move(request));
|
| +}
|
| +
|
| +SharedMemoryAllocatorImpl::SharedMemoryAllocatorImpl()
|
| + : bitmap_manager_client_(HostSharedBitmapManager::current()) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +}
|
| +
|
| +SharedMemoryAllocatorImpl::~SharedMemoryAllocatorImpl() {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +}
|
| +
|
| +void SharedMemoryAllocatorImpl::AllocatedSharedBitmap(
|
| + mojo::ScopedSharedBufferHandle buffer,
|
| + const gpu::Mailbox& id) {
|
| + base::SharedMemoryHandle memory_handle;
|
| + size_t size;
|
| + MojoResult result = mojo::UnwrapSharedMemoryHandle(
|
| + std::move(buffer), &memory_handle, &size, NULL);
|
| + DCHECK_EQ(result, MOJO_RESULT_OK);
|
| + bitmap_manager_client_.ChildAllocatedSharedBitmap(size, memory_handle, id);
|
| +}
|
| +
|
| +void SharedMemoryAllocatorImpl::DeletedSharedBitmap(const gpu::Mailbox& id) {
|
| + bitmap_manager_client_.ChildDeletedSharedBitmap(id);
|
| +}
|
| +
|
| +} // namespace content
|
|
|