Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/gpu/gpu_data_manager_impl.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 6 | 6 |
| 7 #include "content/browser/gpu/gpu_data_manager_impl_private.h" | 7 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
| 8 #include "gpu/ipc/common/memory_stats.h" | 8 #include "gpu/ipc/common/memory_stats.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 GpuDataManager* GpuDataManager::GetInstance() { | 13 GpuDataManager* GpuDataManager::GetInstance() { |
| 14 return GpuDataManagerImpl::GetInstance(); | 14 return GpuDataManagerImpl::GetInstance(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 // static | 17 // static |
| 18 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { | 18 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { |
| 19 return base::Singleton<GpuDataManagerImpl>::get(); | 19 return base::Singleton<GpuDataManagerImpl>::get(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void GpuDataManagerImpl::BlacklistWebGLForTesting() { | |
| 23 // Manually generate the following data instead of going through | |
| 24 // gpu/config/process_json.py because this is just one simple instance. | |
| 25 static const int kFeatureListForEntry0[1] = { | |
| 26 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL | |
| 27 }; | |
| 28 static const gpu::GpuControlList::Entry kEntry = { | |
| 29 1, // id | |
| 30 "ExtensionWebstoreGetWebGLStatusTest.Blocked", | |
| 31 1, // features size | |
|
Ken Russell (switch to Gerrit)
2017/03/31 02:37:06
Could consider revising this handwritten entry to
Zhenyao Mo
2017/03/31 19:14:13
Done.
| |
| 32 kFeatureListForEntry0, // features | |
| 33 0, // DisabledExtensions size | |
| 34 nullptr, // DisabledExtensions | |
| 35 0, // CrBugs size | |
| 36 nullptr, // CrBugs | |
| 37 { | |
| 38 gpu::GpuControlList::kOsAny, // os_type | |
| 39 {gpu::GpuControlList::kUnknown, | |
| 40 gpu::GpuControlList::kVersionStyleNumerical, | |
| 41 nullptr, nullptr}, // os_version | |
| 42 0x00, // vendor_id | |
| 43 0, // DeviceIDs size | |
| 44 nullptr, // DeviceIDs | |
| 45 gpu::GpuControlList::kMultiGpuCategoryNone, // multi_gpu_category | |
| 46 gpu::GpuControlList::kMultiGpuStyleNone, // multi_gpu_style | |
| 47 nullptr, // driver info | |
| 48 nullptr, // GL strings | |
| 49 nullptr, // machine model info | |
| 50 nullptr, // more conditions | |
| 51 }, | |
| 52 0, // exceptions count | |
| 53 nullptr, // exceptions | |
| 54 }; | |
| 55 static const gpu::GpuControlListData kData("1.0", 1, &kEntry); | |
| 56 | |
| 57 gpu::GPUInfo gpu_info; | |
| 58 | |
| 59 base::AutoLock auto_lock(lock_); | |
| 60 private_->InitializeForTesting(kData, gpu_info); | |
| 61 } | |
| 62 | |
| 22 void GpuDataManagerImpl::InitializeForTesting( | 63 void GpuDataManagerImpl::InitializeForTesting( |
| 23 const std::string& gpu_blacklist_json, const gpu::GPUInfo& gpu_info) { | 64 const gpu::GpuControlListData& gpu_blacklist_data, |
| 65 const gpu::GPUInfo& gpu_info) { | |
| 24 base::AutoLock auto_lock(lock_); | 66 base::AutoLock auto_lock(lock_); |
| 25 private_->InitializeForTesting(gpu_blacklist_json, gpu_info); | 67 private_->InitializeForTesting(gpu_blacklist_data, gpu_info); |
| 26 } | 68 } |
| 27 | 69 |
| 28 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { | 70 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { |
| 29 base::AutoLock auto_lock(lock_); | 71 base::AutoLock auto_lock(lock_); |
| 30 return private_->IsFeatureBlacklisted(feature); | 72 return private_->IsFeatureBlacklisted(feature); |
| 31 } | 73 } |
| 32 | 74 |
| 33 bool GpuDataManagerImpl::IsFeatureEnabled(int feature) const { | 75 bool GpuDataManagerImpl::IsFeatureEnabled(int feature) const { |
| 34 base::AutoLock auto_lock(lock_); | 76 base::AutoLock auto_lock(lock_); |
| 35 return private_->IsFeatureEnabled(feature); | 77 return private_->IsFeatureEnabled(feature); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 } | 316 } |
| 275 | 317 |
| 276 GpuDataManagerImpl::GpuDataManagerImpl() | 318 GpuDataManagerImpl::GpuDataManagerImpl() |
| 277 : private_(GpuDataManagerImplPrivate::Create(this)) { | 319 : private_(GpuDataManagerImplPrivate::Create(this)) { |
| 278 } | 320 } |
| 279 | 321 |
| 280 GpuDataManagerImpl::~GpuDataManagerImpl() { | 322 GpuDataManagerImpl::~GpuDataManagerImpl() { |
| 281 } | 323 } |
| 282 | 324 |
| 283 } // namespace content | 325 } // namespace content |
| OLD | NEW |