| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/ui/public/cpp/gpu_service.h" | 5 #include "services/ui/public/cpp/gpu_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Wait until the pending establishing task is finished. | 97 // Wait until the pending establishing task is finished. |
| 98 do { | 98 do { |
| 99 establishing_condition_.Wait(); | 99 establishing_condition_.Wait(); |
| 100 } while (is_establishing_); | 100 } while (is_establishing_); |
| 101 } | 101 } |
| 102 return gpu_channel_; | 102 return gpu_channel_; |
| 103 } | 103 } |
| 104 | 104 |
| 105 gpu::GpuMemoryBufferManager* GpuService::GetGpuMemoryBufferManager() { |
| 106 return gpu_memory_buffer_manager_.get(); |
| 107 } |
| 108 |
| 105 scoped_refptr<gpu::GpuChannelHost> GpuService::GetGpuChannelLocked() { | 109 scoped_refptr<gpu::GpuChannelHost> GpuService::GetGpuChannelLocked() { |
| 106 if (gpu_channel_ && gpu_channel_->IsLost()) { | 110 if (gpu_channel_ && gpu_channel_->IsLost()) { |
| 107 main_task_runner_->PostTask( | 111 main_task_runner_->PostTask( |
| 108 FROM_HERE, | 112 FROM_HERE, |
| 109 base::Bind(&gpu::GpuChannelHost::DestroyChannel, gpu_channel_)); | 113 base::Bind(&gpu::GpuChannelHost::DestroyChannel, gpu_channel_)); |
| 110 gpu_channel_ = nullptr; | 114 gpu_channel_ = nullptr; |
| 111 } | 115 } |
| 112 return gpu_channel_; | 116 return gpu_channel_; |
| 113 } | 117 } |
| 114 | 118 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 MojoResult result = mojo::UnwrapSharedMemoryHandle( | 221 MojoResult result = mojo::UnwrapSharedMemoryHandle( |
| 218 std::move(handle), &platform_handle, &shared_memory_size, &readonly); | 222 std::move(handle), &platform_handle, &shared_memory_size, &readonly); |
| 219 if (result != MOJO_RESULT_OK) | 223 if (result != MOJO_RESULT_OK) |
| 220 return nullptr; | 224 return nullptr; |
| 221 DCHECK_EQ(shared_memory_size, size); | 225 DCHECK_EQ(shared_memory_size, size); |
| 222 | 226 |
| 223 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); | 227 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); |
| 224 } | 228 } |
| 225 | 229 |
| 226 } // namespace ui | 230 } // namespace ui |
| OLD | NEW |