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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <queue> | 12 #include <queue> |
12 #include <set> | 13 #include <set> |
13 #include <string> | 14 #include <string> |
14 | 15 |
15 #include "base/callback.h" | 16 #include "base/callback.h" |
16 #include "base/containers/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/scoped_ptr.h" | |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "content/common/gpu_process_launch_causes.h" | 24 #include "content/common/gpu_process_launch_causes.h" |
25 #include "content/public/browser/browser_child_process_host_delegate.h" | 25 #include "content/public/browser/browser_child_process_host_delegate.h" |
26 #include "content/public/browser/gpu_data_manager.h" | 26 #include "content/public/browser/gpu_data_manager.h" |
27 #include "gpu/command_buffer/common/constants.h" | 27 #include "gpu/command_buffer/common/constants.h" |
28 #include "gpu/config/gpu_info.h" | 28 #include "gpu/config/gpu_info.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // of a separate GPU process. | 242 // of a separate GPU process. |
243 bool in_process_; | 243 bool in_process_; |
244 | 244 |
245 bool swiftshader_rendering_; | 245 bool swiftshader_rendering_; |
246 GpuProcessKind kind_; | 246 GpuProcessKind kind_; |
247 | 247 |
248 // The GPUInfo for the connected process. Only valid after initialized_ is | 248 // The GPUInfo for the connected process. Only valid after initialized_ is |
249 // true. | 249 // true. |
250 gpu::GPUInfo gpu_info_; | 250 gpu::GPUInfo gpu_info_; |
251 | 251 |
252 scoped_ptr<base::Thread> in_process_gpu_thread_; | 252 std::unique_ptr<base::Thread> in_process_gpu_thread_; |
253 | 253 |
254 // Whether we actually launched a GPU process. | 254 // Whether we actually launched a GPU process. |
255 bool process_launched_; | 255 bool process_launched_; |
256 | 256 |
257 // Whether the GPU process successfully initialized. | 257 // Whether the GPU process successfully initialized. |
258 bool initialized_; | 258 bool initialized_; |
259 | 259 |
260 // Time Init started. Used to log total GPU process startup time to UMA. | 260 // Time Init started. Used to log total GPU process startup time to UMA. |
261 base::TimeTicks init_start_time_; | 261 base::TimeTicks init_start_time_; |
262 | 262 |
263 // Master switch for enabling/disabling GPU acceleration for the current | 263 // Master switch for enabling/disabling GPU acceleration for the current |
264 // browser session. It does not change the acceleration settings for | 264 // browser session. It does not change the acceleration settings for |
265 // existing tabs, just the future ones. | 265 // existing tabs, just the future ones. |
266 static bool gpu_enabled_; | 266 static bool gpu_enabled_; |
267 | 267 |
268 static bool hardware_gpu_enabled_; | 268 static bool hardware_gpu_enabled_; |
269 | 269 |
270 static int gpu_crash_count_; | 270 static int gpu_crash_count_; |
271 static int gpu_recent_crash_count_; | 271 static int gpu_recent_crash_count_; |
272 static bool crashed_before_; | 272 static bool crashed_before_; |
273 static int swiftshader_crash_count_; | 273 static int swiftshader_crash_count_; |
274 | 274 |
275 scoped_ptr<BrowserChildProcessHostImpl> process_; | 275 std::unique_ptr<BrowserChildProcessHostImpl> process_; |
276 | 276 |
277 // Track the URLs of the pages which have live offscreen contexts, | 277 // Track the URLs of the pages which have live offscreen contexts, |
278 // assumed to be associated with untrusted content such as WebGL. | 278 // assumed to be associated with untrusted content such as WebGL. |
279 // For best robustness, when any context lost notification is | 279 // For best robustness, when any context lost notification is |
280 // received, assume all of these URLs are guilty, and block | 280 // received, assume all of these URLs are guilty, and block |
281 // automatic execution of 3D content from those domains. | 281 // automatic execution of 3D content from those domains. |
282 std::multiset<GURL> urls_with_live_offscreen_contexts_; | 282 std::multiset<GURL> urls_with_live_offscreen_contexts_; |
283 | 283 |
284 // Statics kept around to send to UMA histograms on GPU process lost. | 284 // Statics kept around to send to UMA histograms on GPU process lost. |
285 bool uma_memory_stats_received_; | 285 bool uma_memory_stats_received_; |
286 gpu::GPUMemoryUmaStats uma_memory_stats_; | 286 gpu::GPUMemoryUmaStats uma_memory_stats_; |
287 | 287 |
288 typedef std::map<int32_t, scoped_refptr<ShaderDiskCache>> | 288 typedef std::map<int32_t, scoped_refptr<ShaderDiskCache>> |
289 ClientIdToShaderCacheMap; | 289 ClientIdToShaderCacheMap; |
290 ClientIdToShaderCacheMap client_id_to_shader_cache_; | 290 ClientIdToShaderCacheMap client_id_to_shader_cache_; |
291 | 291 |
292 std::string shader_prefix_key_; | 292 std::string shader_prefix_key_; |
293 | 293 |
294 // Browser-side Mojo endpoint which sets up a Mojo channel with the child | 294 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
295 // process and contains the browser's ServiceRegistry. | 295 // process and contains the browser's ServiceRegistry. |
296 scoped_ptr<MojoApplicationHost> mojo_application_host_; | 296 std::unique_ptr<MojoApplicationHost> mojo_application_host_; |
297 | 297 |
298 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 298 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
299 }; | 299 }; |
300 | 300 |
301 } // namespace content | 301 } // namespace content |
302 | 302 |
303 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 303 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |