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> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 static bool gpu_enabled() { return gpu_enabled_; } | 85 static bool gpu_enabled() { return gpu_enabled_; } |
86 static int gpu_crash_count() { return gpu_crash_count_; } | 86 static int gpu_crash_count() { return gpu_crash_count_; } |
87 | 87 |
88 // Creates a new GpuProcessHost (if |force_create| is turned on) or gets an | 88 // Creates a new GpuProcessHost (if |force_create| is turned on) or gets an |
89 // existing one, resulting in the launching of a GPU process if required. | 89 // existing one, resulting in the launching of a GPU process if required. |
90 // Returns null on failure. It is not safe to store the pointer once control | 90 // Returns null on failure. It is not safe to store the pointer once control |
91 // has returned to the message loop as it can be destroyed. Instead store the | 91 // has returned to the message loop as it can be destroyed. Instead store the |
92 // associated GPU host ID. This could return NULL if GPU access is not | 92 // associated GPU host ID. This could return NULL if GPU access is not |
93 // allowed (blacklisted). | 93 // allowed (blacklisted). |
94 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, | 94 CONTENT_EXPORT static GpuProcessHost* Get( |
95 bool force_create = true); | 95 GpuProcessKind kind = GPU_PROCESS_KIND_SANDBOXED, |
| 96 bool force_create = true); |
96 | 97 |
97 // Retrieves a list of process handles for all gpu processes. | 98 // Returns whether there is an active GPU process or not. |
98 static void GetProcessHandles( | 99 static void GetHasGpuProcess(const base::Callback<void(bool)>& callback); |
99 const GpuDataManager::GetGpuProcessHandlesCallback& callback); | |
100 | 100 |
101 // Helper function to run a callback on the IO thread. The callback receives | 101 // Helper function to run a callback on the IO thread. The callback receives |
102 // the appropriate GpuProcessHost instance. Note that the callback can be | 102 // the appropriate GpuProcessHost instance. Note that the callback can be |
103 // called with a null host (e.g. when |force_create| is false, and no | 103 // called with a null host (e.g. when |force_create| is false, and no |
104 // GpuProcessHost instance exists). | 104 // GpuProcessHost instance exists). |
105 CONTENT_EXPORT static void CallOnIO( | 105 CONTENT_EXPORT static void CallOnIO( |
106 GpuProcessKind kind, | 106 GpuProcessKind kind, |
107 bool force_create, | 107 bool force_create, |
108 const base::Callback<void(GpuProcessHost*)>& callback); | 108 const base::Callback<void(GpuProcessHost*)>& callback); |
109 | 109 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 gpu::GpuProcessHostActivityFlags activity_flags_; | 295 gpu::GpuProcessHostActivityFlags activity_flags_; |
296 | 296 |
297 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_; | 297 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_; |
298 | 298 |
299 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 299 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
300 }; | 300 }; |
301 | 301 |
302 } // namespace content | 302 } // namespace content |
303 | 303 |
304 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 304 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |