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 "mojo/common/weak_binding_set.h" |
| 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
23 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
24 | 26 |
25 namespace gpu { | 27 namespace gpu { |
26 class SyncPointManager; | 28 class SyncPointManager; |
27 } | 29 } |
28 | 30 |
29 namespace sandbox { | 31 namespace sandbox { |
30 class TargetServices; | 32 class TargetServices; |
31 } | 33 } |
32 | 34 |
33 namespace content { | 35 namespace content { |
34 class GpuMemoryBufferFactory; | 36 class GpuMemoryBufferFactory; |
| 37 class GpuProcessControlImpl; |
35 class GpuWatchdogThread; | 38 class GpuWatchdogThread; |
| 39 class ProcessControl; |
36 | 40 |
37 // The main thread of the GPU child process. There will only ever be one of | 41 // The main thread of the GPU child process. There will only ever be one of |
38 // these per process. It does process initialization and shutdown. It forwards | 42 // these per process. It does process initialization and shutdown. It forwards |
39 // IPC messages to GpuChannelManager, which is responsible for issuing rendering | 43 // IPC messages to GpuChannelManager, which is responsible for issuing rendering |
40 // commands to the GPU. | 44 // commands to the GPU. |
41 class GpuChildThread : public ChildThreadImpl { | 45 class GpuChildThread : public ChildThreadImpl { |
42 public: | 46 public: |
43 typedef std::queue<IPC::Message*> DeferredMessages; | 47 typedef std::queue<IPC::Message*> DeferredMessages; |
44 | 48 |
45 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, | 49 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, |
(...skipping 30 matching lines...) Expand all Loading... |
76 void OnClean(); | 80 void OnClean(); |
77 void OnCrash(); | 81 void OnCrash(); |
78 void OnHang(); | 82 void OnHang(); |
79 void OnDisableWatchdog(); | 83 void OnDisableWatchdog(); |
80 void OnGpuSwitched(); | 84 void OnGpuSwitched(); |
81 | 85 |
82 #if defined(USE_TCMALLOC) | 86 #if defined(USE_TCMALLOC) |
83 void OnGetGpuTcmalloc(); | 87 void OnGetGpuTcmalloc(); |
84 #endif | 88 #endif |
85 | 89 |
| 90 void BindProcessControlRequest( |
| 91 mojo::InterfaceRequest<ProcessControl> request); |
| 92 |
86 // Set this flag to true if a fatal error occurred before we receive the | 93 // Set this flag to true if a fatal error occurred before we receive the |
87 // OnInitialize message, in which case we just declare ourselves DOA. | 94 // OnInitialize message, in which case we just declare ourselves DOA. |
88 bool dead_on_arrival_; | 95 bool dead_on_arrival_; |
89 base::Time process_start_time_; | 96 base::Time process_start_time_; |
90 scoped_refptr<GpuWatchdogThread> watchdog_thread_; | 97 scoped_refptr<GpuWatchdogThread> watchdog_thread_; |
91 | 98 |
92 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
93 // Windows specific client sandbox interface. | 100 // Windows specific client sandbox interface. |
94 sandbox::TargetServices* target_services_; | 101 sandbox::TargetServices* target_services_; |
95 #endif | 102 #endif |
96 | 103 |
97 // Non-owning. | 104 // Non-owning. |
98 gpu::SyncPointManager* sync_point_manager_; | 105 gpu::SyncPointManager* sync_point_manager_; |
99 | 106 |
100 scoped_ptr<GpuChannelManager> gpu_channel_manager_; | 107 scoped_ptr<GpuChannelManager> gpu_channel_manager_; |
101 | 108 |
102 // Information about the GPU, such as device and vendor ID. | 109 // Information about the GPU, such as device and vendor ID. |
103 gpu::GPUInfo gpu_info_; | 110 gpu::GPUInfo gpu_info_; |
104 | 111 |
105 // Error messages collected in gpu_main() before the thread is created. | 112 // Error messages collected in gpu_main() before the thread is created. |
106 DeferredMessages deferred_messages_; | 113 DeferredMessages deferred_messages_; |
107 | 114 |
108 // Whether the GPU thread is running in the browser process. | 115 // Whether the GPU thread is running in the browser process. |
109 bool in_browser_process_; | 116 bool in_browser_process_; |
110 | 117 |
111 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. | 118 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. |
112 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 119 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
113 | 120 |
| 121 // Process control for Mojo application hosting. |
| 122 scoped_ptr<GpuProcessControlImpl> process_control_; |
| 123 |
| 124 // Bindings to the ProcessControl impl. |
| 125 mojo::WeakBindingSet<ProcessControl> process_control_bindings_; |
| 126 |
114 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 127 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
115 }; | 128 }; |
116 | 129 |
117 } // namespace content | 130 } // namespace content |
118 | 131 |
119 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 132 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
OLD | NEW |