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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> | 61 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> |
62 EstablishChannelCallback; | 62 EstablishChannelCallback; |
63 | 63 |
64 typedef base::Callback<void(CreateCommandBufferResult)> | 64 typedef base::Callback<void(CreateCommandBufferResult)> |
65 CreateCommandBufferCallback; | 65 CreateCommandBufferCallback; |
66 | 66 |
67 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 67 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
68 CreateGpuMemoryBufferCallback; | 68 CreateGpuMemoryBufferCallback; |
69 | 69 |
70 static bool gpu_enabled() { return gpu_enabled_; } | 70 static bool gpu_enabled() { return gpu_enabled_; } |
| 71 static int gpu_crash_count() { return gpu_crash_count_; } |
71 | 72 |
72 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 73 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
73 // launching of a GPU process if required. Returns null on failure. It | 74 // launching of a GPU process if required. Returns null on failure. It |
74 // is not safe to store the pointer once control has returned to the message | 75 // is not safe to store the pointer once control has returned to the message |
75 // loop as it can be destroyed. Instead store the associated GPU host ID. | 76 // loop as it can be destroyed. Instead store the associated GPU host ID. |
76 // This could return NULL if GPU access is not allowed (blacklisted). | 77 // This could return NULL if GPU access is not allowed (blacklisted). |
77 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, | 78 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, |
78 CauseForGpuLaunch cause); | 79 CauseForGpuLaunch cause); |
79 | 80 |
80 // Retrieves a list of process handles for all gpu processes. | 81 // Retrieves a list of process handles for all gpu processes. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Time Init started. Used to log total GPU process startup time to UMA. | 227 // Time Init started. Used to log total GPU process startup time to UMA. |
227 base::TimeTicks init_start_time_; | 228 base::TimeTicks init_start_time_; |
228 | 229 |
229 // Master switch for enabling/disabling GPU acceleration for the current | 230 // Master switch for enabling/disabling GPU acceleration for the current |
230 // browser session. It does not change the acceleration settings for | 231 // browser session. It does not change the acceleration settings for |
231 // existing tabs, just the future ones. | 232 // existing tabs, just the future ones. |
232 static bool gpu_enabled_; | 233 static bool gpu_enabled_; |
233 | 234 |
234 static bool hardware_gpu_enabled_; | 235 static bool hardware_gpu_enabled_; |
235 | 236 |
| 237 static int gpu_crash_count_; |
| 238 static int gpu_recent_crash_count_; |
| 239 static base::Time last_gpu_crash_time_; |
| 240 static bool crashed_before_; |
| 241 static int swiftshader_crash_count_; |
| 242 |
236 scoped_ptr<BrowserChildProcessHostImpl> process_; | 243 scoped_ptr<BrowserChildProcessHostImpl> process_; |
237 | 244 |
238 // Track the URLs of the pages which have live offscreen contexts, | 245 // Track the URLs of the pages which have live offscreen contexts, |
239 // assumed to be associated with untrusted content such as WebGL. | 246 // assumed to be associated with untrusted content such as WebGL. |
240 // For best robustness, when any context lost notification is | 247 // For best robustness, when any context lost notification is |
241 // received, assume all of these URLs are guilty, and block | 248 // received, assume all of these URLs are guilty, and block |
242 // automatic execution of 3D content from those domains. | 249 // automatic execution of 3D content from those domains. |
243 std::multiset<GURL> urls_with_live_offscreen_contexts_; | 250 std::multiset<GURL> urls_with_live_offscreen_contexts_; |
244 | 251 |
245 // Statics kept around to send to UMA histograms on GPU process lost. | 252 // Statics kept around to send to UMA histograms on GPU process lost. |
(...skipping 19 matching lines...) Expand all Loading... |
265 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > | 272 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > |
266 SurfaceRefMap; | 273 SurfaceRefMap; |
267 SurfaceRefMap surface_refs_; | 274 SurfaceRefMap surface_refs_; |
268 | 275 |
269 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 276 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
270 }; | 277 }; |
271 | 278 |
272 } // namespace content | 279 } // namespace content |
273 | 280 |
274 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 281 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |