| Index: services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.cc
|
| diff --git a/services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.cc b/services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.cc
|
| index efff978265a194c569cf66a21390ef61eb3c0bee..e91fce823c9a275b56d5c4d4c2ac701edd965d31 100644
|
| --- a/services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.cc
|
| +++ b/services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.cc
|
| @@ -21,6 +21,13 @@
|
| namespace ui {
|
|
|
| namespace {
|
| +
|
| +void OnGpuMemoryBufferAllocated(gfx::GpuMemoryBufferHandle* ret_handle,
|
| + base::WaitableEvent* wait,
|
| + const gfx::GpuMemoryBufferHandle& handle) {
|
| + *ret_handle = handle;
|
| + wait->Signal();
|
| +}
|
|
|
| void NotifyDestructionOnCorrectThread(
|
| scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
| @@ -51,24 +58,12 @@
|
|
|
| void ClientGpuMemoryBufferManager::InitThread(mojom::GpuPtrInfo gpu_info) {
|
| gpu_.Bind(std::move(gpu_info));
|
| - gpu_.set_connection_error_handler(
|
| - base::Bind(&ClientGpuMemoryBufferManager::DisconnectGpuOnThread,
|
| - base::Unretained(this)));
|
| weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
|
| }
|
|
|
| void ClientGpuMemoryBufferManager::TearDownThread() {
|
| weak_ptr_factory_.InvalidateWeakPtrs();
|
| - DisconnectGpuOnThread();
|
| -}
|
| -
|
| -void ClientGpuMemoryBufferManager::DisconnectGpuOnThread() {
|
| - if (!gpu_.is_bound())
|
| - return;
|
| gpu_.reset();
|
| - for (auto& waiter : pending_allocation_waiters_)
|
| - waiter->Signal();
|
| - pending_allocation_waiters_.clear();
|
| }
|
|
|
| void ClientGpuMemoryBufferManager::AllocateGpuMemoryBufferOnThread(
|
| @@ -81,24 +76,9 @@
|
| // |handle| and |wait| are both on the stack, and will be alive until |wait|
|
| // is signaled. So it is safe for OnGpuMemoryBufferAllocated() to operate on
|
| // these.
|
| - pending_allocation_waiters_.insert(wait);
|
| gpu_->CreateGpuMemoryBuffer(
|
| gfx::GpuMemoryBufferId(++counter_), size, format, usage,
|
| - base::Bind(
|
| - &ClientGpuMemoryBufferManager::OnGpuMemoryBufferAllocatedOnThread,
|
| - base::Unretained(this), handle, wait));
|
| -}
|
| -
|
| -void ClientGpuMemoryBufferManager::OnGpuMemoryBufferAllocatedOnThread(
|
| - gfx::GpuMemoryBufferHandle* ret_handle,
|
| - base::WaitableEvent* wait,
|
| - const gfx::GpuMemoryBufferHandle& handle) {
|
| - auto it = pending_allocation_waiters_.find(wait);
|
| - DCHECK(it != pending_allocation_waiters_.end());
|
| - pending_allocation_waiters_.erase(it);
|
| -
|
| - *ret_handle = handle;
|
| - wait->Signal();
|
| + base::Bind(&OnGpuMemoryBufferAllocated, handle, wait));
|
| }
|
|
|
| void ClientGpuMemoryBufferManager::DeletedGpuMemoryBuffer(
|
|
|