| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/gpu/gpu_data_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const ListValue& GpuDataManager::log_messages() const { | 91 const ListValue& GpuDataManager::log_messages() const { |
| 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 93 return log_messages_; | 93 return log_messages_; |
| 94 } | 94 } |
| 95 | 95 |
| 96 GpuFeatureFlags GpuDataManager::GetGpuFeatureFlags() { | 96 GpuFeatureFlags GpuDataManager::GetGpuFeatureFlags() { |
| 97 return gpu_feature_flags_; | 97 return gpu_feature_flags_; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool GpuDataManager::GpuAccessAllowed() { | 100 bool GpuDataManager::GpuAccessAllowed() { |
| 101 return gpu_feature_flags_.flags() == 0; | 101 uint32 flags = gpu_feature_flags_.flags(); |
| 102 |
| 103 // This will in effect block access to all GPU features if any of them |
| 104 // is blacklisted. |
| 105 // TODO(vangelis): Restructure the code to make it possible to selectively |
| 106 // blaclist gpu features. |
| 107 return !(flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas || |
| 108 flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing || |
| 109 flags & GpuFeatureFlags::kGpuFeatureWebgl); |
| 102 } | 110 } |
| 103 | 111 |
| 104 void GpuDataManager::AddGpuInfoUpdateCallback(Callback0::Type* callback) { | 112 void GpuDataManager::AddGpuInfoUpdateCallback(Callback0::Type* callback) { |
| 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 106 gpu_info_update_callbacks_.insert(callback); | 114 gpu_info_update_callbacks_.insert(callback); |
| 107 } | 115 } |
| 108 | 116 |
| 109 bool GpuDataManager::RemoveGpuInfoUpdateCallback(Callback0::Type* callback) { | 117 bool GpuDataManager::RemoveGpuInfoUpdateCallback(Callback0::Type* callback) { |
| 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 111 std::set<Callback0::Type*>::iterator i = | 119 std::set<Callback0::Type*>::iterator i = |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 214 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 207 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 215 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
| 208 browser_command_line.GetSwitchValueASCII( | 216 browser_command_line.GetSwitchValueASCII( |
| 209 switches::kUseGL) == gfx::kGLImplementationOSMesaName) | 217 switches::kUseGL) == gfx::kGLImplementationOSMesaName) |
| 210 return NULL; | 218 return NULL; |
| 211 // No need to return an empty blacklist. | 219 // No need to return an empty blacklist. |
| 212 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) | 220 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) |
| 213 return NULL; | 221 return NULL; |
| 214 return gpu_blacklist_.get(); | 222 return gpu_blacklist_.get(); |
| 215 } | 223 } |
| OLD | NEW |