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 <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/child/child_thread_impl.h" | 17 #include "content/child/child_thread_impl.h" |
18 #include "content/common/gpu/gpu_channel.h" | 18 #include "content/common/gpu/gpu_channel.h" |
19 #include "content/common/gpu/gpu_channel_manager.h" | 19 #include "content/common/gpu/gpu_channel_manager.h" |
20 #include "content/common/gpu/gpu_config.h" | 20 #include "content/common/gpu/gpu_config.h" |
21 #include "content/common/gpu/x_util.h" | 21 #include "content/common/gpu/x_util.h" |
22 #include "gpu/config/gpu_info.h" | 22 #include "gpu/config/gpu_info.h" |
23 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
24 | 24 |
| 25 namespace gpu { |
| 26 class SyncPointManager; |
| 27 } |
| 28 |
25 namespace sandbox { | 29 namespace sandbox { |
26 class TargetServices; | 30 class TargetServices; |
27 } | 31 } |
28 | 32 |
29 namespace content { | 33 namespace content { |
30 class GpuMemoryBufferFactory; | 34 class GpuMemoryBufferFactory; |
31 class GpuWatchdogThread; | 35 class GpuWatchdogThread; |
32 | 36 |
33 // The main thread of the GPU child process. There will only ever be one of | 37 // The main thread of the GPU child process. There will only ever be one of |
34 // these per process. It does process initialization and shutdown. It forwards | 38 // these per process. It does process initialization and shutdown. It forwards |
35 // IPC messages to GpuChannelManager, which is responsible for issuing rendering | 39 // IPC messages to GpuChannelManager, which is responsible for issuing rendering |
36 // commands to the GPU. | 40 // commands to the GPU. |
37 class GpuChildThread : public ChildThreadImpl { | 41 class GpuChildThread : public ChildThreadImpl { |
38 public: | 42 public: |
39 typedef std::queue<IPC::Message*> DeferredMessages; | 43 typedef std::queue<IPC::Message*> DeferredMessages; |
40 | 44 |
41 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, | 45 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, |
42 bool dead_on_arrival, | 46 bool dead_on_arrival, |
43 const gpu::GPUInfo& gpu_info, | 47 const gpu::GPUInfo& gpu_info, |
44 const DeferredMessages& deferred_messages, | 48 const DeferredMessages& deferred_messages, |
45 GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 49 GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
| 50 gpu::SyncPointManager* sync_point_manager); |
46 | 51 |
47 GpuChildThread(const InProcessChildThreadParams& params, | 52 GpuChildThread(const InProcessChildThreadParams& params, |
48 GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 53 GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
| 54 gpu::SyncPointManager* sync_point_manager); |
49 | 55 |
50 ~GpuChildThread() override; | 56 ~GpuChildThread() override; |
51 | 57 |
52 static gfx::GpuMemoryBufferType GetGpuMemoryBufferFactoryType(); | 58 static gfx::GpuMemoryBufferType GetGpuMemoryBufferFactoryType(); |
53 | 59 |
54 void Shutdown() override; | 60 void Shutdown() override; |
55 | 61 |
56 void Init(const base::Time& process_start_time); | 62 void Init(const base::Time& process_start_time); |
57 void StopWatchdog(); | 63 void StopWatchdog(); |
58 | 64 |
(...skipping 22 matching lines...) Expand all Loading... |
81 // OnInitialize message, in which case we just declare ourselves DOA. | 87 // OnInitialize message, in which case we just declare ourselves DOA. |
82 bool dead_on_arrival_; | 88 bool dead_on_arrival_; |
83 base::Time process_start_time_; | 89 base::Time process_start_time_; |
84 scoped_refptr<GpuWatchdogThread> watchdog_thread_; | 90 scoped_refptr<GpuWatchdogThread> watchdog_thread_; |
85 | 91 |
86 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
87 // Windows specific client sandbox interface. | 93 // Windows specific client sandbox interface. |
88 sandbox::TargetServices* target_services_; | 94 sandbox::TargetServices* target_services_; |
89 #endif | 95 #endif |
90 | 96 |
| 97 // Non-owning. |
| 98 gpu::SyncPointManager* sync_point_manager_; |
| 99 |
91 scoped_ptr<GpuChannelManager> gpu_channel_manager_; | 100 scoped_ptr<GpuChannelManager> gpu_channel_manager_; |
92 | 101 |
93 // Information about the GPU, such as device and vendor ID. | 102 // Information about the GPU, such as device and vendor ID. |
94 gpu::GPUInfo gpu_info_; | 103 gpu::GPUInfo gpu_info_; |
95 | 104 |
96 // Error messages collected in gpu_main() before the thread is created. | 105 // Error messages collected in gpu_main() before the thread is created. |
97 DeferredMessages deferred_messages_; | 106 DeferredMessages deferred_messages_; |
98 | 107 |
99 // Whether the GPU thread is running in the browser process. | 108 // Whether the GPU thread is running in the browser process. |
100 bool in_browser_process_; | 109 bool in_browser_process_; |
101 | 110 |
102 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. | 111 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. |
103 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 112 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
104 | 113 |
105 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 114 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
106 }; | 115 }; |
107 | 116 |
108 } // namespace content | 117 } // namespace content |
109 | 118 |
110 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 119 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
OLD | NEW |