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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_
6 #define CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/public/browser/gpu_data_manager_observer.h"
11 #include "gpu/config/gpu_feature_type.h"
15 } // namespace content
17 class GPUFeatureChecker
: public base::RefCountedThreadSafe
<GPUFeatureChecker
>,
18 public content::GpuDataManagerObserver
{
20 typedef base::Callback
<void(bool feature_available
)> FeatureAvailableCallback
;
22 GPUFeatureChecker(gpu::GpuFeatureType feature
,
23 FeatureAvailableCallback callback
);
25 // Check to see if |feature_| is available on the current GPU. |callback_|
26 // will be called to indicate the availability of the feature. Must be called
27 // from the the UI thread.
28 void CheckGPUFeatureAvailability();
30 // content::GpuDataManagerObserver
31 void OnGpuInfoUpdate() override
;
34 friend class base::RefCountedThreadSafe
<GPUFeatureChecker
>;
36 ~GPUFeatureChecker() override
;
38 gpu::GpuFeatureType feature_
;
39 FeatureAvailableCallback callback_
;
41 DISALLOW_COPY_AND_ASSIGN(GPUFeatureChecker
);
44 #endif // CHROME_BROWSER_GPU_GPU_FEATURE_CHECKER_H_