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 static const gpu::GpuControlList::Entry kEntry = { |
| 28 1, // id |
| 29 "ExtensionWebstoreGetWebGLStatusTest.Blocked", |
| 30 arraysize(kFeatureListForEntry0), // features size |
| 31 kFeatureListForEntry0, // features |
| 32 0, // DisabledExtensions size |
| 33 nullptr, // DisabledExtensions |
| 34 0, // CrBugs size |
| 35 nullptr, // CrBugs |
| 36 { |
| 37 gpu::GpuControlList::kOsAny, // os_type |
| 38 {gpu::GpuControlList::kUnknown, |
| 39 gpu::GpuControlList::kVersionStyleNumerical, nullptr, |
| 40 nullptr}, // os_version |
| 41 0x00, // vendor_id |
| 42 0, // DeviceIDs size |
| 43 nullptr, // DeviceIDs |
| 44 gpu::GpuControlList::kMultiGpuCategoryNone, // multi_gpu_category |
| 45 gpu::GpuControlList::kMultiGpuStyleNone, // multi_gpu_style |
| 46 nullptr, // driver info |
| 47 nullptr, // GL strings |
| 48 nullptr, // machine model info |
| 49 nullptr, // more conditions |
| 50 }, |
| 51 0, // exceptions count |
| 52 nullptr, // exceptions |
| 53 }; |
| 54 static const gpu::GpuControlListData kData("1.0", 1, &kEntry); |
| 55 |
| 56 gpu::GPUInfo gpu_info; |
| 57 |
| 58 base::AutoLock auto_lock(lock_); |
| 59 private_->InitializeForTesting(kData, gpu_info); |
| 60 } |
| 61 |
22 void GpuDataManagerImpl::InitializeForTesting( | 62 void GpuDataManagerImpl::InitializeForTesting( |
23 const std::string& gpu_blacklist_json, const gpu::GPUInfo& gpu_info) { | 63 const gpu::GpuControlListData& gpu_blacklist_data, |
| 64 const gpu::GPUInfo& gpu_info) { |
24 base::AutoLock auto_lock(lock_); | 65 base::AutoLock auto_lock(lock_); |
25 // Relax the cross-thread access restriction to non-thread-safe RefCount. | 66 // Relax the cross-thread access restriction to non-thread-safe RefCount. |
26 // See the comment in Initialize(). | 67 // See the comment in Initialize(). |
27 base::ScopedAllowCrossThreadRefCountAccess | 68 base::ScopedAllowCrossThreadRefCountAccess |
28 allow_cross_thread_ref_count_access; | 69 allow_cross_thread_ref_count_access; |
29 private_->InitializeForTesting(gpu_blacklist_json, gpu_info); | 70 private_->InitializeForTesting(gpu_blacklist_data, gpu_info); |
30 } | 71 } |
31 | 72 |
32 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { | 73 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { |
33 base::AutoLock auto_lock(lock_); | 74 base::AutoLock auto_lock(lock_); |
34 return private_->IsFeatureBlacklisted(feature); | 75 return private_->IsFeatureBlacklisted(feature); |
35 } | 76 } |
36 | 77 |
37 bool GpuDataManagerImpl::IsFeatureEnabled(int feature) const { | 78 bool GpuDataManagerImpl::IsFeatureEnabled(int feature) const { |
38 base::AutoLock auto_lock(lock_); | 79 base::AutoLock auto_lock(lock_); |
39 return private_->IsFeatureEnabled(feature); | 80 return private_->IsFeatureEnabled(feature); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 332 } |
292 | 333 |
293 GpuDataManagerImpl::GpuDataManagerImpl() | 334 GpuDataManagerImpl::GpuDataManagerImpl() |
294 : private_(GpuDataManagerImplPrivate::Create(this)) { | 335 : private_(GpuDataManagerImplPrivate::Create(this)) { |
295 } | 336 } |
296 | 337 |
297 GpuDataManagerImpl::~GpuDataManagerImpl() { | 338 GpuDataManagerImpl::~GpuDataManagerImpl() { |
298 } | 339 } |
299 | 340 |
300 } // namespace content | 341 } // namespace content |
OLD | NEW |