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 CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_ | 5 #ifndef CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_ |
6 #define CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_ | 6 #define CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/public/browser/gpu_data_manager_observer.h" | 11 #include "content/public/browser/gpu_data_manager_observer.h" |
12 #include "gpu/config/gpu_feature_type.h" | 12 #include "gpu/config/gpu_feature_type.h" |
13 | 13 |
14 namespace content { | |
15 class GpuDataManager; | |
16 } // namespace content | |
17 | |
18 class GPUFeatureChecker : public base::RefCountedThreadSafe<GPUFeatureChecker>, | 14 class GPUFeatureChecker : public base::RefCountedThreadSafe<GPUFeatureChecker>, |
19 public content::GpuDataManagerObserver { | 15 public content::GpuDataManagerObserver { |
20 public: | 16 public: |
21 typedef base::Callback<void(bool feature_available)> FeatureAvailableCallback; | 17 typedef base::Callback<void(bool feature_available)> FeatureAvailableCallback; |
22 | 18 |
23 GPUFeatureChecker(gpu::GpuFeatureType feature, | 19 GPUFeatureChecker(gpu::GpuFeatureType feature, |
24 FeatureAvailableCallback callback); | 20 FeatureAvailableCallback callback); |
25 | 21 |
26 // Check to see if |feature_| is available on the current GPU. |callback_| | 22 // Check to see if |feature_| is available on the current GPU. |callback_| |
27 // will be called to indicate the availability of the feature. Must be called | 23 // will be called to indicate the availability of the feature. Must be called |
28 // from the the UI thread. | 24 // from the the UI thread. |
29 void CheckGPUFeatureAvailability(); | 25 void CheckGPUFeatureAvailability(); |
30 | 26 |
31 // content::GpuDataManagerObserver | 27 // content::GpuDataManagerObserver |
32 void OnGpuInfoUpdate() override; | 28 void OnGpuInfoUpdate() override; |
33 | 29 |
34 private: | 30 private: |
35 friend class base::RefCountedThreadSafe<GPUFeatureChecker>; | 31 friend class base::RefCountedThreadSafe<GPUFeatureChecker>; |
36 | 32 |
37 ~GPUFeatureChecker() override; | 33 ~GPUFeatureChecker() override; |
38 | 34 |
39 gpu::GpuFeatureType feature_; | 35 gpu::GpuFeatureType feature_; |
40 FeatureAvailableCallback callback_; | 36 FeatureAvailableCallback callback_; |
41 | 37 |
42 DISALLOW_COPY_AND_ASSIGN(GPUFeatureChecker); | 38 DISALLOW_COPY_AND_ASSIGN(GPUFeatureChecker); |
43 }; | 39 }; |
44 | 40 |
45 #endif // CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_ | 41 #endif // CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_ |
OLD | NEW |