| 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 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 scoped_refptr<cc::ContextProvider> CreateContextProvider( | 44 scoped_refptr<cc::ContextProvider> CreateContextProvider( |
| 45 scoped_refptr<gpu::GpuChannelHost> gpu_channel); | 45 scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
| 46 | 46 |
| 47 // gpu::GpuChannelEstablishFactory: | 47 // gpu::GpuChannelEstablishFactory: |
| 48 void EstablishGpuChannel( | 48 void EstablishGpuChannel( |
| 49 const gpu::GpuChannelEstablishedCallback& callback) override; | 49 const gpu::GpuChannelEstablishedCallback& callback) override; |
| 50 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override; | 50 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override; |
| 51 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; | 51 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 friend struct base::DefaultSingletonTraits<Gpu>; | 54 friend class GpuTest; |
| 55 | 55 |
| 56 Gpu(service_manager::Connector* connector, | 56 using GpuPtrFactory = base::RepeatingCallback<mojom::GpuPtr(void)>; |
| 57 const std::string& service_name, | 57 Gpu(GpuPtrFactory factory, |
| 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 59 | 59 |
| 60 scoped_refptr<gpu::GpuChannelHost> GetGpuChannel(); | 60 scoped_refptr<gpu::GpuChannelHost> GetGpuChannel(); |
| 61 void OnEstablishedGpuChannel(int client_id, | 61 void OnEstablishedGpuChannel(int client_id, |
| 62 mojo::ScopedMessagePipeHandle channel_handle, | 62 mojo::ScopedMessagePipeHandle channel_handle, |
| 63 const gpu::GPUInfo& gpu_info); | 63 const gpu::GPUInfo& gpu_info); |
| 64 | 64 |
| 65 // gpu::GpuChannelHostFactory overrides: | 65 // gpu::GpuChannelHostFactory overrides: |
| 66 bool IsMainThread() override; | 66 bool IsMainThread() override; |
| 67 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | 67 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
| 68 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | 68 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
| 69 size_t size) override; | 69 size_t size) override; |
| 70 | 70 |
| 71 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 71 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 73 service_manager::Connector* connector_; | 73 GpuPtrFactory factory_; |
| 74 const std::string service_name_; | |
| 75 base::WaitableEvent shutdown_event_; | 74 base::WaitableEvent shutdown_event_; |
| 76 std::unique_ptr<base::Thread> io_thread_; | 75 std::unique_ptr<base::Thread> io_thread_; |
| 77 std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 76 std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 78 | 77 |
| 79 ui::mojom::GpuPtr gpu_; | 78 ui::mojom::GpuPtr gpu_; |
| 80 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | 79 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
| 81 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_; | 80 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_; |
| 82 | 81 |
| 83 DISALLOW_COPY_AND_ASSIGN(Gpu); | 82 DISALLOW_COPY_AND_ASSIGN(Gpu); |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 } // namespace ui | 85 } // namespace ui |
| 87 | 86 |
| 88 #endif // SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ | 87 #endif // SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ |
| OLD | NEW |