| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "cc/output/vulkan_in_process_context_provider.h" | 5 #include "cc/output/vulkan_in_process_context_provider.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "gpu/vulkan/vulkan_device_queue.h" | 9 #include "gpu/vulkan/vulkan_device_queue.h" |
| 10 | 10 |
| 11 #if defined(VK_USE_PLATFORM_XLIB_KHR) | 11 #if defined(VK_USE_PLATFORM_XLIB_KHR) |
| 12 #include "ui/gfx/x/x11_types.h" | 12 #include "ui/gfx/x/x11_types.h" |
| 13 #endif // defined(VK_USE_PLATFORM_XLIB_KHR) | 13 #endif // defined(VK_USE_PLATFORM_XLIB_KHR) |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 scoped_refptr<VulkanInProcessContextProvider> | 17 scoped_refptr<VulkanInProcessContextProvider> |
| 18 VulkanInProcessContextProvider::Create() { | 18 VulkanInProcessContextProvider::Create() { |
| 19 scoped_refptr<VulkanInProcessContextProvider> context_provider( | 19 scoped_refptr<VulkanInProcessContextProvider> context_provider( |
| 20 new VulkanInProcessContextProvider); | 20 new VulkanInProcessContextProvider); |
| 21 if (!context_provider->Initialize()) | 21 if (!context_provider->Initialize()) |
| 22 return nullptr; | 22 return nullptr; |
| 23 return context_provider; | 23 return context_provider; |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool VulkanInProcessContextProvider::Initialize() { | 26 bool VulkanInProcessContextProvider::Initialize() { |
| 27 scoped_ptr<gpu::VulkanDeviceQueue> device_queue(new gpu::VulkanDeviceQueue); | 27 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue( |
| 28 new gpu::VulkanDeviceQueue); |
| 28 if (device_queue->Initialize( | 29 if (device_queue->Initialize( |
| 29 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | | 30 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | |
| 30 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { | 31 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { |
| 31 device_queue_ = std::move(device_queue); | 32 device_queue_ = std::move(device_queue); |
| 32 return true; | 33 return true; |
| 33 } | 34 } |
| 34 | 35 |
| 35 return false; | 36 return false; |
| 36 } | 37 } |
| 37 | 38 |
| 38 void VulkanInProcessContextProvider::Destroy() { | 39 void VulkanInProcessContextProvider::Destroy() { |
| 39 if (device_queue_) { | 40 if (device_queue_) { |
| 40 device_queue_->Destroy(); | 41 device_queue_->Destroy(); |
| 41 device_queue_.reset(); | 42 device_queue_.reset(); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { | 46 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { |
| 46 return device_queue_.get(); | 47 return device_queue_.get(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} | 50 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} |
| 50 | 51 |
| 51 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {} | 52 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {} |
| 52 | 53 |
| 53 } // namespace cc | 54 } // namespace cc |
| OLD | NEW |