OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DATA_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
| 12 #include "base/file_path.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
14 #include "base/observer_list_threadsafe.h" | 15 #include "base/observer_list_threadsafe.h" |
15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
16 #include "base/task.h" | 17 #include "base/task.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
18 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
19 #include "content/common/gpu/gpu_feature_flags.h" | 20 #include "content/common/gpu/gpu_feature_flags.h" |
20 #include "content/public/common/gpu_info.h" | 21 #include "content/public/common/gpu_info.h" |
21 | 22 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // TODO(zmo): Get rid of preliminary because it should not be exposed to | 121 // TODO(zmo): Get rid of preliminary because it should not be exposed to |
121 // outside GpuDataManager. | 122 // outside GpuDataManager. |
122 void UpdateGpuBlacklist(GpuBlacklist* updated_list, bool preliminary); | 123 void UpdateGpuBlacklist(GpuBlacklist* updated_list, bool preliminary); |
123 | 124 |
124 // This gets called when switching GPU might have happened. | 125 // This gets called when switching GPU might have happened. |
125 void HandleGpuSwitch(); | 126 void HandleGpuSwitch(); |
126 | 127 |
127 // Returns the Gpu Info as a DictionaryValue. | 128 // Returns the Gpu Info as a DictionaryValue. |
128 DictionaryValue* GpuInfoAsDictionaryValue() const; | 129 DictionaryValue* GpuInfoAsDictionaryValue() const; |
129 | 130 |
| 131 // Returns true if the software rendering should currently be used. |
| 132 bool software_rendering(); |
| 133 |
| 134 // Register a path to the SwiftShader software renderer. |
| 135 void RegisterSwiftShaderPath(FilePath path); |
| 136 |
130 private: | 137 private: |
131 class UserFlags { | 138 class UserFlags { |
132 public: | 139 public: |
133 UserFlags(); | 140 UserFlags(); |
134 | 141 |
135 void Initialize(); | 142 void Initialize(); |
136 | 143 |
137 bool disable_accelerated_2d_canvas() const { | 144 bool disable_accelerated_2d_canvas() const { |
138 return disable_accelerated_2d_canvas_; | 145 return disable_accelerated_2d_canvas_; |
139 } | 146 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // If it's a different GPU, then reset and copy over everything. | 211 // If it's a different GPU, then reset and copy over everything. |
205 // Return true if something changes that may affect blacklisting; currently | 212 // Return true if something changes that may affect blacklisting; currently |
206 // they are device_id, vendor_id, driver_vendor, driver_version, driver_date, | 213 // they are device_id, vendor_id, driver_vendor, driver_version, driver_date, |
207 // and gl_renderer. | 214 // and gl_renderer. |
208 static bool Merge(content::GPUInfo* object, const content::GPUInfo& other); | 215 static bool Merge(content::GPUInfo* object, const content::GPUInfo& other); |
209 | 216 |
210 // Determin if accelerated-2d-canvas is supported, which depends on whether | 217 // Determin if accelerated-2d-canvas is supported, which depends on whether |
211 // lose_context could happen and whether skia is the backend. | 218 // lose_context could happen and whether skia is the backend. |
212 bool supportsAccelerated2dCanvas() const; | 219 bool supportsAccelerated2dCanvas() const; |
213 | 220 |
| 221 // Try to switch to software rendering, if possible and necessary. |
| 222 void EnableSoftwareRenderingIfNecessary(); |
| 223 |
214 bool complete_gpu_info_already_requested_; | 224 bool complete_gpu_info_already_requested_; |
215 | 225 |
216 GpuFeatureFlags gpu_feature_flags_; | 226 GpuFeatureFlags gpu_feature_flags_; |
217 GpuFeatureFlags preliminary_gpu_feature_flags_; | 227 GpuFeatureFlags preliminary_gpu_feature_flags_; |
218 | 228 |
219 UserFlags user_flags_; | 229 UserFlags user_flags_; |
220 | 230 |
221 content::GPUInfo gpu_info_; | 231 content::GPUInfo gpu_info_; |
222 mutable base::Lock gpu_info_lock_; | 232 mutable base::Lock gpu_info_lock_; |
223 | 233 |
224 scoped_ptr<GpuBlacklist> gpu_blacklist_; | 234 scoped_ptr<GpuBlacklist> gpu_blacklist_; |
225 | 235 |
226 // Observers. | 236 // Observers. |
227 const scoped_refptr<GpuDataManagerObserverList> observer_list_; | 237 const scoped_refptr<GpuDataManagerObserverList> observer_list_; |
228 | 238 |
229 ListValue log_messages_; | 239 ListValue log_messages_; |
| 240 bool software_rendering_; |
| 241 |
| 242 FilePath swiftshader_path_; |
230 | 243 |
231 DISALLOW_COPY_AND_ASSIGN(GpuDataManager); | 244 DISALLOW_COPY_AND_ASSIGN(GpuDataManager); |
232 }; | 245 }; |
233 | 246 |
234 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_H_ | 247 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_H_ |
OLD | NEW |