| 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 #include "chrome/browser/gpu/gpu_feature_checker.h" | 5 #include "chrome/browser/gpu/gpu_feature_checker.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" |
| 8 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/gpu_data_manager.h" | 10 #include "content/public/browser/gpu_data_manager.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 // A false return value is always valid, but a true one is only valid if full | 14 // A false return value is always valid, but a true one is only valid if full |
| 14 // GPU info has been collected in a GPU process. | 15 // GPU info has been collected in a GPU process. |
| 15 bool IsFeatureAllowed(content::GpuDataManager* manager, | 16 bool IsFeatureAllowed(content::GpuDataManager* manager, |
| 16 gpu::GpuFeatureType feature) { | 17 gpu::GpuFeatureType feature) { |
| 17 return (manager->GpuAccessAllowed(NULL) && | 18 return (manager->GpuAccessAllowed(NULL) && |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 62 |
| 62 void GPUFeatureChecker::OnGpuInfoUpdate() { | 63 void GPUFeatureChecker::OnGpuInfoUpdate() { |
| 63 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); | 64 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); |
| 64 manager->RemoveObserver(this); | 65 manager->RemoveObserver(this); |
| 65 bool feature_allowed = IsFeatureAllowed(manager, feature_); | 66 bool feature_allowed = IsFeatureAllowed(manager, feature_); |
| 66 callback_.Run(feature_allowed); | 67 callback_.Run(feature_allowed); |
| 67 | 68 |
| 68 // Matches the AddRef in HasFeature(). | 69 // Matches the AddRef in HasFeature(). |
| 69 Release(); | 70 Release(); |
| 70 } | 71 } |
| OLD | NEW |