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_MUS_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
6 #define SERVICES_UI_GPU_GPU_SERVICE_MUS_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" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "gpu/command_buffer/service/gpu_preferences.h" | 13 #include "gpu/command_buffer/service/gpu_preferences.h" |
14 #include "gpu/config/gpu_info.h" | 14 #include "gpu/config/gpu_info.h" |
15 #include "gpu/ipc/client/gpu_channel_host.h" | 15 #include "gpu/ipc/client/gpu_channel_host.h" |
16 #include "gpu/ipc/common/surface_handle.h" | 16 #include "gpu/ipc/common/surface_handle.h" |
(...skipping 16 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 namespace media { | 35 namespace media { |
36 class MediaService; | 36 class MediaService; |
37 } | 37 } |
38 | 38 |
39 namespace ui { | 39 namespace ui { |
40 | 40 |
41 class MusGpuMemoryBufferManager; | 41 class MusGpuMemoryBufferManager; |
42 | 42 |
43 // TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus. | 43 // TODO(sad): GpuChannelManagerDelegate implementation should be in the gpu |
44 // Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a | 44 // process, and the GpuChannelHostFactory should be in the host process (i.e. |
45 // GpuChannelManager. | 45 // the window-server process). So the GpuChannelHostFactory parts of this should |
46 class GpuServiceMus : public gpu::GpuChannelManagerDelegate, | 46 // be split out. |
47 public gpu::GpuChannelHostFactory, | 47 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate, |
48 public base::NonThreadSafe { | 48 public gpu::GpuChannelHostFactory, |
| 49 public base::NonThreadSafe { |
49 public: | 50 public: |
50 typedef base::Callback<void(int client_id, mojo::ScopedMessagePipeHandle)> | 51 typedef base::Callback<void(int client_id, mojo::ScopedMessagePipeHandle)> |
51 EstablishGpuChannelCallback; | 52 EstablishGpuChannelCallback; |
52 void EstablishGpuChannel(uint64_t client_tracing_id, | 53 void EstablishGpuChannel(uint64_t client_tracing_id, |
53 bool preempts, | 54 bool preempts, |
54 bool allow_view_command_buffers, | 55 bool allow_view_command_buffers, |
55 bool allow_real_time_streams, | 56 bool allow_real_time_streams, |
56 const EstablishGpuChannelCallback& callback); | 57 const EstablishGpuChannelCallback& callback); |
57 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 58 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
58 gfx::GpuMemoryBufferId id, | 59 gfx::GpuMemoryBufferId id, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 gpu::SurfaceHandle child_window) override; | 103 gpu::SurfaceHandle child_window) override; |
103 #endif | 104 #endif |
104 void SetActiveURL(const GURL& url) override; | 105 void SetActiveURL(const GURL& url) override; |
105 | 106 |
106 // GpuChannelHostFactory overrides: | 107 // GpuChannelHostFactory overrides: |
107 bool IsMainThread() override; | 108 bool IsMainThread() override; |
108 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | 109 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
109 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | 110 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
110 size_t size) override; | 111 size_t size) override; |
111 | 112 |
112 static GpuServiceMus* GetInstance(); | 113 // TODO(sad): This should not be a singleton. |
| 114 static GpuServiceInternal* GetInstance(); |
113 | 115 |
114 private: | 116 private: |
115 friend struct base::DefaultSingletonTraits<GpuServiceMus>; | 117 friend struct base::DefaultSingletonTraits<GpuServiceInternal>; |
116 | 118 |
117 GpuServiceMus(); | 119 GpuServiceInternal(); |
118 ~GpuServiceMus() override; | 120 ~GpuServiceInternal() override; |
119 | 121 |
120 void Initialize(); | 122 void Initialize(); |
121 void InitializeOnGpuThread(mojo::ScopedMessagePipeHandle* channel_handle, | 123 void InitializeOnGpuThread(mojo::ScopedMessagePipeHandle* channel_handle, |
122 base::WaitableEvent* event); | 124 base::WaitableEvent* event); |
123 void EstablishGpuChannelOnGpuThread( | 125 void EstablishGpuChannelOnGpuThread( |
124 int client_id, | 126 int client_id, |
125 uint64_t client_tracing_id, | 127 uint64_t client_tracing_id, |
126 bool preempts, | 128 bool preempts, |
127 bool allow_view_command_buffers, | 129 bool allow_view_command_buffers, |
128 bool allow_real_time_streams, | 130 bool allow_real_time_streams, |
(...skipping 26 matching lines...) Expand all Loading... |
155 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_local_; | 157 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_local_; |
156 | 158 |
157 // A GPU channel used locally. | 159 // A GPU channel used locally. |
158 scoped_refptr<gpu::GpuChannelHost> gpu_channel_local_; | 160 scoped_refptr<gpu::GpuChannelHost> gpu_channel_local_; |
159 | 161 |
160 gpu::GpuPreferences gpu_preferences_; | 162 gpu::GpuPreferences gpu_preferences_; |
161 | 163 |
162 // Information about the GPU, such as device and vendor ID. | 164 // Information about the GPU, such as device and vendor ID. |
163 gpu::GPUInfo gpu_info_; | 165 gpu::GPUInfo gpu_info_; |
164 | 166 |
165 DISALLOW_COPY_AND_ASSIGN(GpuServiceMus); | 167 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); |
166 }; | 168 }; |
167 | 169 |
168 } // namespace ui | 170 } // namespace ui |
169 | 171 |
170 #endif // SERVICES_UI_GPU_GPU_SERVICE_MUS_H_ | 172 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
OLD | NEW |