| 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 "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/gpu_data_manager.h" | 9 #include "content/public/browser/gpu_data_manager.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 bool finalized = true; | 35 bool finalized = true; |
| 36 #if defined(OS_LINUX) | 36 #if defined(OS_LINUX) |
| 37 // On Windows and Mac, so far we can always make the final WebGL blacklisting | 37 // On Windows and Mac, so far we can always make the final WebGL blacklisting |
| 38 // decision based on partial GPU info; on Linux, we need to launch the GPU | 38 // decision based on partial GPU info; on Linux, we need to launch the GPU |
| 39 // process to collect full GPU info and make the final decision. | 39 // process to collect full GPU info and make the final decision. |
| 40 finalized = false; | 40 finalized = false; |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); | 43 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); |
| 44 if (manager->IsCompleteGpuInfoAvailable()) | 44 if (manager->IsEssentialGpuInfoAvailable()) |
| 45 finalized = true; | 45 finalized = true; |
| 46 | 46 |
| 47 bool feature_allowed = IsFeatureAllowed(manager, feature_); | 47 bool feature_allowed = IsFeatureAllowed(manager, feature_); |
| 48 if (!feature_allowed) | 48 if (!feature_allowed) |
| 49 finalized = true; | 49 finalized = true; |
| 50 | 50 |
| 51 if (finalized) { | 51 if (finalized) { |
| 52 callback_.Run(feature_allowed); | 52 callback_.Run(feature_allowed); |
| 53 } else { | 53 } else { |
| 54 // Matched with a Release in OnGpuInfoUpdate. | 54 // Matched with a Release in OnGpuInfoUpdate. |
| 55 AddRef(); | 55 AddRef(); |
| 56 | 56 |
| 57 manager->AddObserver(this); | 57 manager->AddObserver(this); |
| 58 manager->RequestCompleteGpuInfoIfNeeded(); | 58 manager->RequestCompleteGpuInfoIfNeeded(); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void GPUFeatureChecker::OnGpuInfoUpdate() { | 62 void GPUFeatureChecker::OnGpuInfoUpdate() { |
| 63 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); | 63 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); |
| 64 manager->RemoveObserver(this); | 64 manager->RemoveObserver(this); |
| 65 bool feature_allowed = IsFeatureAllowed(manager, feature_); | 65 bool feature_allowed = IsFeatureAllowed(manager, feature_); |
| 66 callback_.Run(feature_allowed); | 66 callback_.Run(feature_allowed); |
| 67 | 67 |
| 68 // Matches the AddRef in HasFeature(). | 68 // Matches the AddRef in HasFeature(). |
| 69 Release(); | 69 Release(); |
| 70 } | 70 } |
| OLD | NEW |