| 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 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/observer_list_threadsafe.h" | 15 #include "base/observer_list_threadsafe.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "content/public/browser/gpu_data_manager.h" | 18 #include "content/public/browser/gpu_data_manager.h" |
| 19 #include "content/public/common/gpu_info.h" | 19 #include "content/public/common/gpu_info.h" |
| 20 | 20 |
| 21 class CommandLine; | 21 class CommandLine; |
| 22 | 22 |
| 23 class CONTENT_EXPORT GpuDataManagerImpl | 23 class CONTENT_EXPORT GpuDataManagerImpl |
| 24 : public NON_EXPORTED_BASE(content::GpuDataManager) { | 24 : public NON_EXPORTED_BASE(content::GpuDataManager) { |
| 25 public: | 25 public: |
| 26 // Getter for the singleton. This will return NULL on failure. | 26 // Getter for the singleton. This will return NULL on failure. |
| 27 static GpuDataManagerImpl* GetInstance(); | 27 static GpuDataManagerImpl* GetInstance(); |
| 28 | 28 |
| 29 // GpuDataManager implementation: | 29 // GpuDataManager implementation. |
| 30 virtual content::GpuFeatureType GetGpuFeatureType() OVERRIDE; | 30 virtual content::GpuFeatureType GetGpuFeatureType() OVERRIDE; |
| 31 virtual void SetGpuFeatureType(content::GpuFeatureType feature_type) OVERRIDE; | 31 virtual void SetGpuFeatureType(content::GpuFeatureType feature_type) OVERRIDE; |
| 32 virtual content::GPUInfo GetGPUInfo() const OVERRIDE; | 32 virtual content::GPUInfo GetGPUInfo() const OVERRIDE; |
| 33 virtual bool GpuAccessAllowed() OVERRIDE; | 33 virtual bool GpuAccessAllowed() OVERRIDE; |
| 34 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; | 34 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; |
| 35 virtual bool IsCompleteGPUInfoAvailable() const OVERRIDE; | 35 virtual bool IsCompleteGPUInfoAvailable() const OVERRIDE; |
| 36 virtual bool ShouldUseSoftwareRendering() OVERRIDE; | 36 virtual bool ShouldUseSoftwareRendering() OVERRIDE; |
| 37 virtual void RegisterSwiftShaderPath(FilePath path) OVERRIDE; | 37 virtual void RegisterSwiftShaderPath(const FilePath& path) OVERRIDE; |
| 38 virtual const base::ListValue& GetLogMessages() const OVERRIDE; | 38 virtual const base::ListValue& GetLogMessages() const OVERRIDE; |
| 39 virtual void AddObserver(content::GpuDataManagerObserver* observer) OVERRIDE; | 39 virtual void AddObserver(content::GpuDataManagerObserver* observer) OVERRIDE; |
| 40 virtual void RemoveObserver( | 40 virtual void RemoveObserver( |
| 41 content::GpuDataManagerObserver* observer) OVERRIDE; | 41 content::GpuDataManagerObserver* observer) OVERRIDE; |
| 42 | 42 |
| 43 // Only update if the current GPUInfo is not finalized. | 43 // Only update if the current GPUInfo is not finalized. |
| 44 void UpdateGpuInfo(const content::GPUInfo& gpu_info); | 44 void UpdateGpuInfo(const content::GPUInfo& gpu_info); |
| 45 | 45 |
| 46 void AddLogMessage(Value* msg); | 46 void AddLogMessage(Value* msg); |
| 47 | 47 |
| 48 // Inserting disable-feature switches into renderer process command-line | 48 // Inserting disable-feature switches into renderer process command-line |
| 49 // in correspondance to preliminary gpu feature flags. | 49 // in correspondence to preliminary gpu feature flags. |
| 50 void AppendRendererCommandLine(CommandLine* command_line); | 50 void AppendRendererCommandLine(CommandLine* command_line); |
| 51 | 51 |
| 52 // Inserting switches into gpu process command-line: kUseGL, | 52 // Inserting switches into gpu process command-line: kUseGL, |
| 53 // kDisableGLMultisampling. | 53 // kDisableGLMultisampling. |
| 54 void AppendGpuCommandLine(CommandLine* command_line); | 54 void AppendGpuCommandLine(CommandLine* command_line); |
| 55 | 55 |
| 56 // This gets called when switching GPU might have happened. | 56 // This gets called when switching GPU might have happened. |
| 57 void HandleGpuSwitch(); | 57 void HandleGpuSwitch(); |
| 58 | 58 |
| 59 // Force the current card to be blacklisted (usually due to GPU process | 59 // Force the current card to be blacklisted (usually due to GPU process |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 FilePath swiftshader_path_; | 111 FilePath swiftshader_path_; |
| 112 | 112 |
| 113 // Current card force-blacklisted due to GPU crashes. | 113 // Current card force-blacklisted due to GPU crashes. |
| 114 bool card_blacklisted_; | 114 bool card_blacklisted_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 116 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 119 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
| OLD | NEW |