Home | History | Annotate | Download | only in gpu
      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
      3 // found in the LICENSE file.
      4 
      5 #include "content/browser/gpu/gpu_data_manager_impl.h"
      6 
      7 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
      8 
      9 namespace content {
     10 
     11 // static
     12 GpuDataManager* GpuDataManager::GetInstance() {
     13   return GpuDataManagerImpl::GetInstance();
     14 }
     15 
     16 // static
     17 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() {
     18   return Singleton<GpuDataManagerImpl>::get();
     19 }
     20 
     21 void GpuDataManagerImpl::InitializeForTesting(
     22     const std::string& gpu_blacklist_json, const gpu::GPUInfo& gpu_info) {
     23   base::AutoLock auto_lock(lock_);
     24   private_->InitializeForTesting(gpu_blacklist_json, gpu_info);
     25 }
     26 
     27 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
     28   base::AutoLock auto_lock(lock_);
     29   return private_->IsFeatureBlacklisted(feature);
     30 }
     31 
     32 gpu::GPUInfo GpuDataManagerImpl::GetGPUInfo() const {
     33   base::AutoLock auto_lock(lock_);
     34   return private_->GetGPUInfo();
     35 }
     36 
     37 void GpuDataManagerImpl::GetGpuProcessHandles(
     38     const GetGpuProcessHandlesCallback& callback) const {
     39   base::AutoLock auto_lock(lock_);
     40   private_->GetGpuProcessHandles(callback);
     41 }
     42 
     43 bool GpuDataManagerImpl::GpuAccessAllowed(std::string* reason) const {
     44   base::AutoLock auto_lock(lock_);
     45   return private_->GpuAccessAllowed(reason);
     46 }
     47 
     48 void GpuDataManagerImpl::RequestCompleteGpuInfoIfNeeded() {
     49   base::AutoLock auto_lock(lock_);
     50   private_->RequestCompleteGpuInfoIfNeeded();
     51 }
     52 
     53 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const {
     54   base::AutoLock auto_lock(lock_);
     55   return private_->IsCompleteGpuInfoAvailable();
     56 }
     57 
     58 void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() const {
     59   base::AutoLock auto_lock(lock_);
     60   private_->RequestVideoMemoryUsageStatsUpdate();
     61 }
     62 
     63 bool GpuDataManagerImpl::ShouldUseSwiftShader() const {
     64   base::AutoLock auto_lock(lock_);
     65   return private_->ShouldUseSwiftShader();
     66 }
     67 
     68 void GpuDataManagerImpl::RegisterSwiftShaderPath(
     69     const base::FilePath& path) {
     70   base::AutoLock auto_lock(lock_);
     71   private_->RegisterSwiftShaderPath(path);
     72 }
     73 
     74 void GpuDataManagerImpl::AddObserver(
     75     GpuDataManagerObserver* observer) {
     76   base::AutoLock auto_lock(lock_);
     77   private_->AddObserver(observer);
     78 }
     79 
     80 void GpuDataManagerImpl::RemoveObserver(
     81     GpuDataManagerObserver* observer) {
     82   base::AutoLock auto_lock(lock_);
     83   private_->RemoveObserver(observer);
     84 }
     85 
     86 void GpuDataManagerImpl::UnblockDomainFrom3DAPIs(const GURL& url) {
     87   base::AutoLock auto_lock(lock_);
     88   private_->UnblockDomainFrom3DAPIs(url);
     89 }
     90 
     91 void GpuDataManagerImpl::DisableGpuWatchdog() {
     92   base::AutoLock auto_lock(lock_);
     93   private_->DisableGpuWatchdog();
     94 }
     95 
     96 void GpuDataManagerImpl::SetGLStrings(const std::string& gl_vendor,
     97                                       const std::string& gl_renderer,
     98                                       const std::string& gl_version) {
     99   base::AutoLock auto_lock(lock_);
    100   private_->SetGLStrings(gl_vendor, gl_renderer, gl_version);
    101 }
    102 
    103 void GpuDataManagerImpl::GetGLStrings(std::string* gl_vendor,
    104                                       std::string* gl_renderer,
    105                                       std::string* gl_version) {
    106   base::AutoLock auto_lock(lock_);
    107   private_->GetGLStrings(gl_vendor, gl_renderer, gl_version);
    108 }
    109 
    110 void GpuDataManagerImpl::DisableHardwareAcceleration() {
    111   base::AutoLock auto_lock(lock_);
    112   private_->DisableHardwareAcceleration();
    113 }
    114 
    115 void GpuDataManagerImpl::Initialize() {
    116   base::AutoLock auto_lock(lock_);
    117   private_->Initialize();
    118 }
    119 
    120 void GpuDataManagerImpl::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
    121   base::AutoLock auto_lock(lock_);
    122   private_->UpdateGpuInfo(gpu_info);
    123 }
    124 
    125 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats(
    126     const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
    127   base::AutoLock auto_lock(lock_);
    128   private_->UpdateVideoMemoryUsageStats(video_memory_usage_stats);
    129 }
    130 
    131 void GpuDataManagerImpl::AppendRendererCommandLine(
    132     CommandLine* command_line) const {
    133   base::AutoLock auto_lock(lock_);
    134   private_->AppendRendererCommandLine(command_line);
    135 }
    136 
    137 void GpuDataManagerImpl::AppendGpuCommandLine(
    138     CommandLine* command_line) const {
    139   base::AutoLock auto_lock(lock_);
    140   private_->AppendGpuCommandLine(command_line);
    141 }
    142 
    143 void GpuDataManagerImpl::AppendPluginCommandLine(
    144     CommandLine* command_line) const {
    145   base::AutoLock auto_lock(lock_);
    146   private_->AppendPluginCommandLine(command_line);
    147 }
    148 
    149 void GpuDataManagerImpl::UpdateRendererWebPrefs(
    150     WebPreferences* prefs) const {
    151   base::AutoLock auto_lock(lock_);
    152   private_->UpdateRendererWebPrefs(prefs);
    153 }
    154 
    155 gpu::GpuSwitchingOption GpuDataManagerImpl::GetGpuSwitchingOption() const {
    156   base::AutoLock auto_lock(lock_);
    157   return private_->GetGpuSwitchingOption();
    158 }
    159 
    160 std::string GpuDataManagerImpl::GetBlacklistVersion() const {
    161   base::AutoLock auto_lock(lock_);
    162   return private_->GetBlacklistVersion();
    163 }
    164 
    165 std::string GpuDataManagerImpl::GetDriverBugListVersion() const {
    166   base::AutoLock auto_lock(lock_);
    167   return private_->GetDriverBugListVersion();
    168 }
    169 
    170 void GpuDataManagerImpl::GetBlacklistReasons(base::ListValue* reasons) const {
    171   base::AutoLock auto_lock(lock_);
    172   private_->GetBlacklistReasons(reasons);
    173 }
    174 
    175 void GpuDataManagerImpl::GetDriverBugWorkarounds(
    176     base::ListValue* workarounds) const {
    177   base::AutoLock auto_lock(lock_);
    178   private_->GetDriverBugWorkarounds(workarounds);
    179 }
    180 
    181 void GpuDataManagerImpl::AddLogMessage(int level,
    182                                        const std::string& header,
    183                                        const std::string& message) {
    184   base::AutoLock auto_lock(lock_);
    185   private_->AddLogMessage(level, header, message);
    186 }
    187 
    188 void GpuDataManagerImpl::ProcessCrashed(
    189     base::TerminationStatus exit_code) {
    190   base::AutoLock auto_lock(lock_);
    191   private_->ProcessCrashed(exit_code);
    192 }
    193 
    194 base::ListValue* GpuDataManagerImpl::GetLogMessages() const {
    195   base::AutoLock auto_lock(lock_);
    196   return private_->GetLogMessages();
    197 }
    198 
    199 void GpuDataManagerImpl::HandleGpuSwitch() {
    200   base::AutoLock auto_lock(lock_);
    201   private_->HandleGpuSwitch();
    202 }
    203 
    204 #if defined(OS_WIN)
    205 bool GpuDataManagerImpl::IsUsingAcceleratedSurface() const {
    206   base::AutoLock auto_lock(lock_);
    207   return private_->IsUsingAcceleratedSurface();
    208 }
    209 #endif
    210 
    211 bool GpuDataManagerImpl::CanUseGpuBrowserCompositor() const {
    212   base::AutoLock auto_lock(lock_);
    213   return private_->CanUseGpuBrowserCompositor();
    214 }
    215 
    216 void GpuDataManagerImpl::BlockDomainFrom3DAPIs(
    217     const GURL& url, DomainGuilt guilt) {
    218   base::AutoLock auto_lock(lock_);
    219   private_->BlockDomainFrom3DAPIs(url, guilt);
    220 }
    221 
    222 bool GpuDataManagerImpl::Are3DAPIsBlocked(const GURL& url,
    223                                           int render_process_id,
    224                                           int render_view_id,
    225                                           ThreeDAPIType requester) {
    226   base::AutoLock auto_lock(lock_);
    227   return private_->Are3DAPIsBlocked(
    228       url, render_process_id, render_view_id, requester);
    229 }
    230 
    231 void GpuDataManagerImpl::DisableDomainBlockingFor3DAPIsForTesting() {
    232   base::AutoLock auto_lock(lock_);
    233   private_->DisableDomainBlockingFor3DAPIsForTesting();
    234 }
    235 
    236 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const {
    237   base::AutoLock auto_lock(lock_);
    238   return private_->GetBlacklistedFeatureCount();
    239 }
    240 
    241 void GpuDataManagerImpl::SetDisplayCount(unsigned int display_count) {
    242   base::AutoLock auto_lock(lock_);
    243   private_->SetDisplayCount(display_count);
    244 }
    245 
    246 unsigned int GpuDataManagerImpl::GetDisplayCount() const {
    247   base::AutoLock auto_lock(lock_);
    248   return private_->GetDisplayCount();
    249 }
    250 
    251 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url,
    252                                             int render_process_id,
    253                                             int render_view_id,
    254                                             ThreeDAPIType requester) {
    255   base::AutoLock auto_lock(lock_);
    256   private_->Notify3DAPIBlocked(
    257       url, render_process_id, render_view_id, requester);
    258 }
    259 
    260 void GpuDataManagerImpl::OnGpuProcessInitFailure() {
    261   base::AutoLock auto_lock(lock_);
    262   private_->OnGpuProcessInitFailure();
    263 }
    264 
    265 GpuDataManagerImpl::GpuDataManagerImpl()
    266     : private_(GpuDataManagerImplPrivate::Create(this)) {
    267 }
    268 
    269 GpuDataManagerImpl::~GpuDataManagerImpl() {
    270 }
    271 
    272 }  // namespace content
    273