OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_GPU_GPU_CHILD_THREAD_H_ | 5 #ifndef CONTENT_GPU_GPU_CHILD_THREAD_H_ |
6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ | 6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <queue> | 11 #include <queue> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "content/child/child_thread_impl.h" | 21 #include "content/child/child_thread_impl.h" |
22 #include "gpu/command_buffer/service/gpu_preferences.h" | 22 #include "gpu/command_buffer/service/gpu_preferences.h" |
23 #include "gpu/config/gpu_info.h" | 23 #include "gpu/config/gpu_info.h" |
24 #include "gpu/ipc/service/gpu_channel.h" | 24 #include "gpu/ipc/service/gpu_channel.h" |
25 #include "gpu/ipc/service/gpu_channel_manager.h" | 25 #include "gpu/ipc/service/gpu_channel_manager.h" |
26 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 26 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
27 #include "gpu/ipc/service/gpu_config.h" | 27 #include "gpu/ipc/service/gpu_config.h" |
| 28 #include "gpu/ipc/service/gpu_init_delegate.h" |
28 #include "gpu/ipc/service/x_util.h" | 29 #include "gpu/ipc/service/x_util.h" |
29 #include "mojo/public/cpp/bindings/binding_set.h" | 30 #include "mojo/public/cpp/bindings/binding_set.h" |
30 #include "services/shell/public/interfaces/service_factory.mojom.h" | 31 #include "services/shell/public/interfaces/service_factory.mojom.h" |
31 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
32 | 33 |
33 namespace gpu { | 34 namespace gpu { |
34 class GpuMemoryBufferFactory; | 35 class GpuMemoryBufferFactory; |
35 class GpuWatchdogThread; | 36 class GpuWatchdogThread; |
36 class SyncPointManager; | 37 class SyncPointManager; |
37 } | 38 } |
(...skipping 11 matching lines...) Expand all Loading... |
49 struct EstablishChannelParams; | 50 struct EstablishChannelParams; |
50 | 51 |
51 // The main thread of the GPU child process. There will only ever be one of | 52 // The main thread of the GPU child process. There will only ever be one of |
52 // these per process. It does process initialization and shutdown. It forwards | 53 // these per process. It does process initialization and shutdown. It forwards |
53 // IPC messages to gpu::GpuChannelManager, which is responsible for issuing | 54 // IPC messages to gpu::GpuChannelManager, which is responsible for issuing |
54 // rendering commands to the GPU. | 55 // rendering commands to the GPU. |
55 class GpuChildThread : public ChildThreadImpl, | 56 class GpuChildThread : public ChildThreadImpl, |
56 public gpu::GpuChannelManagerDelegate, | 57 public gpu::GpuChannelManagerDelegate, |
57 public base::FieldTrialList::Observer { | 58 public base::FieldTrialList::Observer { |
58 public: | 59 public: |
59 typedef std::queue<IPC::Message*> DeferredMessages; | |
60 | |
61 GpuChildThread(gpu::GpuWatchdogThread* gpu_watchdog_thread, | 60 GpuChildThread(gpu::GpuWatchdogThread* gpu_watchdog_thread, |
62 bool dead_on_arrival, | 61 bool dead_on_arrival, |
63 const gpu::GPUInfo& gpu_info, | 62 const gpu::GPUInfo& gpu_info, |
64 const DeferredMessages& deferred_messages, | 63 std::vector<gpu::GpuInitLogMessage> deferred_messages, |
65 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 64 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); |
66 | 65 |
67 GpuChildThread(const gpu::GpuPreferences& gpu_preferences, | 66 GpuChildThread(const gpu::GpuPreferences& gpu_preferences, |
68 const InProcessChildThreadParams& params, | 67 const InProcessChildThreadParams& params, |
69 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 68 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); |
70 | 69 |
71 ~GpuChildThread() override; | 70 ~GpuChildThread() override; |
72 | 71 |
73 void Shutdown() override; | 72 void Shutdown() override; |
74 | 73 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 148 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
150 | 149 |
151 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 150 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
152 | 151 |
153 std::unique_ptr<media::MediaService> media_service_; | 152 std::unique_ptr<media::MediaService> media_service_; |
154 | 153 |
155 // Information about the GPU, such as device and vendor ID. | 154 // Information about the GPU, such as device and vendor ID. |
156 gpu::GPUInfo gpu_info_; | 155 gpu::GPUInfo gpu_info_; |
157 | 156 |
158 // Error messages collected in gpu_main() before the thread is created. | 157 // Error messages collected in gpu_main() before the thread is created. |
159 DeferredMessages deferred_messages_; | 158 std::vector<gpu::GpuInitLogMessage> deferred_messages_; |
160 | 159 |
161 // Whether the GPU thread is running in the browser process. | 160 // Whether the GPU thread is running in the browser process. |
162 bool in_browser_process_; | 161 bool in_browser_process_; |
163 | 162 |
164 // The gpu::GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. | 163 // The gpu::GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. |
165 gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 164 gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
166 | 165 |
167 // ServiceFactory for shell::Service hosting. | 166 // ServiceFactory for shell::Service hosting. |
168 std::unique_ptr<GpuServiceFactory> service_factory_; | 167 std::unique_ptr<GpuServiceFactory> service_factory_; |
169 | 168 |
170 // Bindings to the shell::mojom::ServiceFactory impl. | 169 // Bindings to the shell::mojom::ServiceFactory impl. |
171 mojo::BindingSet<shell::mojom::ServiceFactory> service_factory_bindings_; | 170 mojo::BindingSet<shell::mojom::ServiceFactory> service_factory_bindings_; |
172 | 171 |
173 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 172 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
174 }; | 173 }; |
175 | 174 |
176 } // namespace content | 175 } // namespace content |
177 | 176 |
178 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 177 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
OLD | NEW |