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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void OnClean(); | 82 void OnClean(); |
79 void OnCrash(); | 83 void OnCrash(); |
80 void OnHang(); | 84 void OnHang(); |
81 void OnDisableWatchdog(); | 85 void OnDisableWatchdog(); |
82 void OnGpuSwitched(); | 86 void OnGpuSwitched(); |
83 | 87 |
84 #if defined(USE_TCMALLOC) | 88 #if defined(USE_TCMALLOC) |
85 void OnGetGpuTcmalloc(); | 89 void OnGetGpuTcmalloc(); |
86 #endif | 90 #endif |
87 | 91 |
| 92 void BindProcessControlRequest( |
| 93 mojo::InterfaceRequest<ProcessControl> request); |
| 94 |
88 // Set this flag to true if a fatal error occurred before we receive the | 95 // Set this flag to true if a fatal error occurred before we receive the |
89 // OnInitialize message, in which case we just declare ourselves DOA. | 96 // OnInitialize message, in which case we just declare ourselves DOA. |
90 bool dead_on_arrival_; | 97 bool dead_on_arrival_; |
91 base::Time process_start_time_; | 98 base::Time process_start_time_; |
92 scoped_refptr<GpuWatchdogThread> watchdog_thread_; | 99 scoped_refptr<GpuWatchdogThread> watchdog_thread_; |
93 | 100 |
94 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
95 // Windows specific client sandbox interface. | 102 // Windows specific client sandbox interface. |
96 sandbox::TargetServices* target_services_; | 103 sandbox::TargetServices* target_services_; |
97 #endif | 104 #endif |
98 | 105 |
99 // Non-owning. | 106 // Non-owning. |
100 gpu::SyncPointManager* sync_point_manager_; | 107 gpu::SyncPointManager* sync_point_manager_; |
101 | 108 |
102 scoped_ptr<GpuChannelManager> gpu_channel_manager_; | 109 scoped_ptr<GpuChannelManager> gpu_channel_manager_; |
103 | 110 |
104 // Information about the GPU, such as device and vendor ID. | 111 // Information about the GPU, such as device and vendor ID. |
105 gpu::GPUInfo gpu_info_; | 112 gpu::GPUInfo gpu_info_; |
106 | 113 |
107 // Error messages collected in gpu_main() before the thread is created. | 114 // Error messages collected in gpu_main() before the thread is created. |
108 DeferredMessages deferred_messages_; | 115 DeferredMessages deferred_messages_; |
109 | 116 |
110 // Whether the GPU thread is running in the browser process. | 117 // Whether the GPU thread is running in the browser process. |
111 bool in_browser_process_; | 118 bool in_browser_process_; |
112 | 119 |
113 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. | 120 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. |
114 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 121 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
115 | 122 |
| 123 // Process control for Mojo application hosting. |
| 124 scoped_ptr<GpuProcessControlImpl> process_control_; |
| 125 |
| 126 // Bindings to the ProcessControl impl. |
| 127 mojo::WeakBindingSet<ProcessControl> process_control_bindings_; |
| 128 |
116 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 129 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
117 }; | 130 }; |
118 | 131 |
119 } // namespace content | 132 } // namespace content |
120 | 133 |
121 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 134 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
OLD | NEW |