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_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const CreateGpuMemoryBufferCallback& callback); | 134 const CreateGpuMemoryBufferCallback& callback); |
135 | 135 |
136 // Tells the GPU process to destroy GPU memory buffer. | 136 // Tells the GPU process to destroy GPU memory buffer. |
137 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 137 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
138 int client_id, | 138 int client_id, |
139 int sync_point); | 139 int sync_point); |
140 | 140 |
141 // What kind of GPU process, e.g. sandboxed or unsandboxed. | 141 // What kind of GPU process, e.g. sandboxed or unsandboxed. |
142 GpuProcessKind kind(); | 142 GpuProcessKind kind(); |
143 | 143 |
| 144 // Forcefully terminates the GPU process. |
144 void ForceShutdown(); | 145 void ForceShutdown(); |
145 | 146 |
| 147 // Asks the GPU process to stop by itself. |
| 148 void StopGpuProcess(); |
| 149 |
146 void BeginFrameSubscription( | 150 void BeginFrameSubscription( |
147 int surface_id, | 151 int surface_id, |
148 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); | 152 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); |
149 void EndFrameSubscription(int surface_id); | 153 void EndFrameSubscription(int surface_id); |
150 void LoadedShader(const std::string& key, const std::string& data); | 154 void LoadedShader(const std::string& key, const std::string& data); |
151 | 155 |
152 private: | 156 private: |
153 static bool ValidateHost(GpuProcessHost* host); | 157 static bool ValidateHost(GpuProcessHost* host); |
154 | 158 |
155 GpuProcessHost(int host_id, GpuProcessKind kind); | 159 GpuProcessHost(int host_id, GpuProcessKind kind); |
156 ~GpuProcessHost() override; | 160 ~GpuProcessHost() override; |
157 | 161 |
158 bool Init(); | 162 bool Init(); |
159 | 163 |
160 // Post an IPC message to the UI shim's message handler on the UI thread. | 164 // Post an IPC message to the UI shim's message handler on the UI thread. |
161 void RouteOnUIThread(const IPC::Message& message); | 165 void RouteOnUIThread(const IPC::Message& message); |
162 | 166 |
163 // BrowserChildProcessHostDelegate implementation. | 167 // BrowserChildProcessHostDelegate implementation. |
164 bool OnMessageReceived(const IPC::Message& message) override; | 168 bool OnMessageReceived(const IPC::Message& message) override; |
165 void OnChannelConnected(int32 peer_pid) override; | 169 void OnChannelConnected(int32 peer_pid) override; |
166 void OnProcessLaunched() override; | 170 void OnProcessLaunched() override; |
| 171 void OnProcessLaunchFailed() override; |
167 void OnProcessCrashed(int exit_code) override; | 172 void OnProcessCrashed(int exit_code) override; |
168 | 173 |
169 // Message handlers. | 174 // Message handlers. |
170 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 175 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
171 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 176 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
172 void OnCommandBufferCreated(CreateCommandBufferResult result); | 177 void OnCommandBufferCreated(CreateCommandBufferResult result); |
173 void OnDestroyCommandBuffer(int32 surface_id); | 178 void OnDestroyCommandBuffer(int32 surface_id); |
174 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 179 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
175 void OnDidCreateOffscreenContext(const GURL& url); | 180 void OnDidCreateOffscreenContext(const GURL& url); |
176 void OnDidLoseContext(bool offscreen, | 181 void OnDidLoseContext(bool offscreen, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 236 |
232 // Whether we actually launched a GPU process. | 237 // Whether we actually launched a GPU process. |
233 bool process_launched_; | 238 bool process_launched_; |
234 | 239 |
235 // Whether the GPU process successfully initialized. | 240 // Whether the GPU process successfully initialized. |
236 bool initialized_; | 241 bool initialized_; |
237 | 242 |
238 // Time Init started. Used to log total GPU process startup time to UMA. | 243 // Time Init started. Used to log total GPU process startup time to UMA. |
239 base::TimeTicks init_start_time_; | 244 base::TimeTicks init_start_time_; |
240 | 245 |
241 // Whether this host recorded a GPU crash or not. | |
242 bool gpu_crash_recorded_; | |
243 | |
244 // Master switch for enabling/disabling GPU acceleration for the current | 246 // Master switch for enabling/disabling GPU acceleration for the current |
245 // browser session. It does not change the acceleration settings for | 247 // browser session. It does not change the acceleration settings for |
246 // existing tabs, just the future ones. | 248 // existing tabs, just the future ones. |
247 static bool gpu_enabled_; | 249 static bool gpu_enabled_; |
248 | 250 |
249 static bool hardware_gpu_enabled_; | 251 static bool hardware_gpu_enabled_; |
250 | 252 |
251 static int gpu_crash_count_; | 253 static int gpu_crash_count_; |
252 static int gpu_recent_crash_count_; | 254 static int gpu_recent_crash_count_; |
253 static bool crashed_before_; | 255 static bool crashed_before_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // IOSurfaces. | 293 // IOSurfaces. |
292 IOSurfaceManagerToken io_surface_manager_token_; | 294 IOSurfaceManagerToken io_surface_manager_token_; |
293 #endif | 295 #endif |
294 | 296 |
295 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 297 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
296 }; | 298 }; |
297 | 299 |
298 } // namespace content | 300 } // namespace content |
299 | 301 |
300 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 302 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |