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_GPU_GPU_SERVICE_INTERNAL_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ | 6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // the window server) over the mojom APIs. This is responsible for setting up | 40 // the window server) over the mojom APIs. This is responsible for setting up |
41 // the connection to clients, allocating/free'ing gpu memory etc. | 41 // the connection to clients, allocating/free'ing gpu memory etc. |
42 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate, | 42 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate, |
43 public mojom::GpuServiceInternal, | 43 public mojom::GpuServiceInternal, |
44 public base::NonThreadSafe { | 44 public base::NonThreadSafe { |
45 public: | 45 public: |
46 ~GpuServiceInternal() override; | 46 ~GpuServiceInternal() override; |
47 | 47 |
48 void Add(mojom::GpuServiceInternalRequest request); | 48 void Add(mojom::GpuServiceInternalRequest request); |
49 | 49 |
50 // TODO(sad): These should be mojom API. | |
51 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | |
52 gfx::GpuMemoryBufferId id, | |
53 const gfx::Size& size, | |
54 gfx::BufferFormat format, | |
55 gfx::BufferUsage usage, | |
56 int client_id, | |
57 gpu::SurfaceHandle surface_handle); | |
58 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
59 int client_id, | |
60 const gpu::SyncToken& sync_token); | |
61 | |
62 private: | 50 private: |
63 friend class GpuMain; | 51 friend class GpuMain; |
64 | 52 |
65 GpuServiceInternal(const gpu::GPUInfo& gpu_info, | 53 GpuServiceInternal(const gpu::GPUInfo& gpu_info, |
66 gpu::GpuWatchdogThread* watchdog, | 54 gpu::GpuWatchdogThread* watchdog, |
67 gpu::GpuMemoryBufferFactory* memory_buffer_factory, | 55 gpu::GpuMemoryBufferFactory* memory_buffer_factory, |
68 scoped_refptr<base::SingleThreadTaskRunner> io_runner); | 56 scoped_refptr<base::SingleThreadTaskRunner> io_runner); |
69 | 57 |
70 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( | 58 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( |
71 gfx::GpuMemoryBufferHandle buffer_handle, | 59 gfx::GpuMemoryBufferHandle buffer_handle, |
(...skipping 19 matching lines...) Expand all Loading... |
91 #endif | 79 #endif |
92 void SetActiveURL(const GURL& url) override; | 80 void SetActiveURL(const GURL& url) override; |
93 | 81 |
94 // mojom::GpuServiceInternal: | 82 // mojom::GpuServiceInternal: |
95 void Initialize(const InitializeCallback& callback) override; | 83 void Initialize(const InitializeCallback& callback) override; |
96 void EstablishGpuChannel( | 84 void EstablishGpuChannel( |
97 int32_t client_id, | 85 int32_t client_id, |
98 uint64_t client_tracing_id, | 86 uint64_t client_tracing_id, |
99 bool is_gpu_host, | 87 bool is_gpu_host, |
100 const EstablishGpuChannelCallback& callback) override; | 88 const EstablishGpuChannelCallback& callback) override; |
| 89 void CreateGpuMemoryBuffer( |
| 90 gfx::GpuMemoryBufferId id, |
| 91 const gfx::Size& size, |
| 92 gfx::BufferFormat format, |
| 93 gfx::BufferUsage usage, |
| 94 int client_id, |
| 95 gpu::SurfaceHandle surface_handle, |
| 96 const CreateGpuMemoryBufferCallback& callback) override; |
| 97 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 98 int client_id, |
| 99 const gpu::SyncToken& sync_token) override; |
101 | 100 |
102 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; | 101 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; |
103 | 102 |
104 // An event that will be signalled when we shutdown. | 103 // An event that will be signalled when we shutdown. |
105 base::WaitableEvent shutdown_event_; | 104 base::WaitableEvent shutdown_event_; |
106 | 105 |
107 gpu::GpuWatchdogThread* watchdog_thread_; | 106 gpu::GpuWatchdogThread* watchdog_thread_; |
108 | 107 |
109 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | 108 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; |
110 | 109 |
111 gpu::GpuPreferences gpu_preferences_; | 110 gpu::GpuPreferences gpu_preferences_; |
112 | 111 |
113 // Information about the GPU, such as device and vendor ID. | 112 // Information about the GPU, such as device and vendor ID. |
114 gpu::GPUInfo gpu_info_; | 113 gpu::GPUInfo gpu_info_; |
115 | 114 |
116 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 115 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
117 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 116 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
118 std::unique_ptr<media::MediaService> media_service_; | 117 std::unique_ptr<media::MediaService> media_service_; |
119 mojo::Binding<mojom::GpuServiceInternal> binding_; | 118 mojo::Binding<mojom::GpuServiceInternal> binding_; |
120 | 119 |
121 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); | 120 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); |
122 }; | 121 }; |
123 | 122 |
124 } // namespace ui | 123 } // namespace ui |
125 | 124 |
126 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ | 125 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
OLD | NEW |