| 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 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 virtual void SetWindowCount(uint32 count) OVERRIDE; | 72 virtual void SetWindowCount(uint32 count) OVERRIDE; |
| 73 virtual uint32 GetWindowCount() const OVERRIDE; | 73 virtual uint32 GetWindowCount() const OVERRIDE; |
| 74 virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE; | 74 virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE; |
| 75 virtual void DisableGpuWatchdog() OVERRIDE; | 75 virtual void DisableGpuWatchdog() OVERRIDE; |
| 76 virtual void SetGLStrings(const std::string& gl_vendor, | 76 virtual void SetGLStrings(const std::string& gl_vendor, |
| 77 const std::string& gl_renderer, | 77 const std::string& gl_renderer, |
| 78 const std::string& gl_version) OVERRIDE; | 78 const std::string& gl_version) OVERRIDE; |
| 79 virtual void GetGLStrings(std::string* gl_vendor, | 79 virtual void GetGLStrings(std::string* gl_vendor, |
| 80 std::string* gl_renderer, | 80 std::string* gl_renderer, |
| 81 std::string* gl_version) OVERRIDE; | 81 std::string* gl_version) OVERRIDE; |
| 82 virtual void DisableHardwareAcceleration() OVERRIDE; |
| 82 | 83 |
| 83 // This collects preliminary GPU info, load GpuBlacklist, and compute the | 84 // This collects preliminary GPU info, load GpuBlacklist, and compute the |
| 84 // preliminary blacklisted features; it should only be called at browser | 85 // preliminary blacklisted features; it should only be called at browser |
| 85 // startup time in UI thread before the IO restriction is turned on. | 86 // startup time in UI thread before the IO restriction is turned on. |
| 86 void Initialize(); | 87 void Initialize(); |
| 87 | 88 |
| 88 // Only update if the current GPUInfo is not finalized. If blacklist is | 89 // Only update if the current GPUInfo is not finalized. If blacklist is |
| 89 // loaded, run through blacklist and update blacklisted features. | 90 // loaded, run through blacklist and update blacklisted features. |
| 90 void UpdateGpuInfo(const GPUInfo& gpu_info); | 91 void UpdateGpuInfo(const GPUInfo& gpu_info); |
| 91 | 92 |
| 92 void UpdateVideoMemoryUsageStats( | 93 void UpdateVideoMemoryUsageStats( |
| 93 const GPUVideoMemoryUsageStats& video_memory_usage_stats); | 94 const GPUVideoMemoryUsageStats& video_memory_usage_stats); |
| 94 | 95 |
| 95 // Insert disable-feature switches corresponding to preliminary gpu feature | 96 // Insert disable-feature switches corresponding to preliminary gpu feature |
| 96 // flags into the renderer process command line. | 97 // flags into the renderer process command line. |
| 97 void AppendRendererCommandLine(CommandLine* command_line) const; | 98 void AppendRendererCommandLine(CommandLine* command_line) const; |
| 98 | 99 |
| 99 // Insert switches into gpu process command line: kUseGL, | 100 // Insert switches into gpu process command line: kUseGL, |
| 100 // kDisableGLMultisampling. | 101 // kDisableGLMultisampling. |
| 101 void AppendGpuCommandLine(CommandLine* command_line) const; | 102 void AppendGpuCommandLine(CommandLine* command_line) const; |
| 102 | 103 |
| 103 // Insert switches into plugin process command line: | 104 // Insert switches into plugin process command line: |
| 104 // kDisableCoreAnimationPlugins. | 105 // kDisableCoreAnimationPlugins. |
| 105 void AppendPluginCommandLine(CommandLine* command_line) const; | 106 void AppendPluginCommandLine(CommandLine* command_line) const; |
| 106 | 107 |
| 107 GpuSwitchingOption GetGpuSwitchingOption() const; | 108 GpuSwitchingOption GetGpuSwitchingOption() const; |
| 108 | 109 |
| 109 // Force the current card to be blacklisted (usually due to GPU process | |
| 110 // crashes). | |
| 111 void BlacklistCard(); | |
| 112 | |
| 113 std::string GetBlacklistVersion() const; | 110 std::string GetBlacklistVersion() const; |
| 114 | 111 |
| 115 // Returns the reasons for the latest run of blacklisting decisions. | 112 // Returns the reasons for the latest run of blacklisting decisions. |
| 116 // For the structure of returned value, see documentation for | 113 // For the structure of returned value, see documentation for |
| 117 // GpuBlacklist::GetBlacklistedReasons(). | 114 // GpuBlacklist::GetBlacklistedReasons(). |
| 118 // Caller is responsible to release the returned value. | 115 // Caller is responsible to release the returned value. |
| 119 base::ListValue* GetBlacklistReasons() const; | 116 base::ListValue* GetBlacklistReasons() const; |
| 120 | 117 |
| 121 void AddLogMessage(int level, | 118 void AddLogMessage(int level, |
| 122 const std::string& header, | 119 const std::string& header, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 typedef std::map<std::string, DomainBlockEntry> DomainBlockMap; | 160 typedef std::map<std::string, DomainBlockEntry> DomainBlockMap; |
| 164 | 161 |
| 165 typedef ObserverListThreadSafe<GpuDataManagerObserver> | 162 typedef ObserverListThreadSafe<GpuDataManagerObserver> |
| 166 GpuDataManagerObserverList; | 163 GpuDataManagerObserverList; |
| 167 | 164 |
| 168 friend class GpuDataManagerImplTest; | 165 friend class GpuDataManagerImplTest; |
| 169 friend struct DefaultSingletonTraits<GpuDataManagerImpl>; | 166 friend struct DefaultSingletonTraits<GpuDataManagerImpl>; |
| 170 | 167 |
| 171 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideBlacklisting); | 168 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideBlacklisting); |
| 172 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideExceptions); | 169 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideExceptions); |
| 173 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, BlacklistCard); | 170 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, |
| 171 DisableHardwareAcceleration); |
| 174 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering); | 172 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering); |
| 175 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering2); | 173 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering2); |
| 176 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate); | 174 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate); |
| 177 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, | 175 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, |
| 178 NoGpuInfoUpdateWithSoftwareRendering); | 176 NoGpuInfoUpdateWithSoftwareRendering); |
| 179 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, | 177 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, |
| 180 GPUVideoMemoryUsageStatsUpdate); | 178 GPUVideoMemoryUsageStatsUpdate); |
| 181 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, | 179 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, |
| 182 BlockAllDomainsFrom3DAPIs); | 180 BlockAllDomainsFrom3DAPIs); |
| 183 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, | 181 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 DomainBlockMap blocked_domains_; | 260 DomainBlockMap blocked_domains_; |
| 263 mutable std::list<base::Time> timestamps_of_gpu_resets_; | 261 mutable std::list<base::Time> timestamps_of_gpu_resets_; |
| 264 bool domain_blocking_enabled_; | 262 bool domain_blocking_enabled_; |
| 265 | 263 |
| 266 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 264 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
| 267 }; | 265 }; |
| 268 | 266 |
| 269 } // namespace content | 267 } // namespace content |
| 270 | 268 |
| 271 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 269 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
| OLD | NEW |