| 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> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/observer_list_threadsafe.h" | 17 #include "base/observer_list_threadsafe.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "content/browser/gpu/gpu_blacklist.h" | 21 #include "content/browser/gpu/gpu_blacklist.h" |
| 22 #include "content/public/browser/gpu_data_manager.h" | 22 #include "content/public/browser/gpu_data_manager.h" |
| 23 #include "content/public/common/gpu_info.h" | 23 #include "content/public/common/gpu_info.h" |
| 24 #include "content/public/common/gpu_memory_stats.h" | 24 #include "content/public/common/gpu_memory_stats.h" |
| 25 #include "content/public/common/three_d_api_types.h" |
| 25 | 26 |
| 26 class CommandLine; | 27 class CommandLine; |
| 27 class GURL; | 28 class GURL; |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 | 31 |
| 31 class CONTENT_EXPORT GpuDataManagerImpl | 32 class CONTENT_EXPORT GpuDataManagerImpl |
| 32 : public NON_EXPORTED_BASE(GpuDataManager) { | 33 : public NON_EXPORTED_BASE(GpuDataManager) { |
| 33 public: | 34 public: |
| 34 // Indicates the guilt level of a domain which caused a GPU reset. | 35 // Indicates the guilt level of a domain which caused a GPU reset. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // the domain has caused the GPU to reset, or because too many GPU | 140 // the domain has caused the GPU to reset, or because too many GPU |
| 140 // resets have been observed globally recently, and system stability | 141 // resets have been observed globally recently, and system stability |
| 141 // might be compromised. | 142 // might be compromised. |
| 142 // | 143 // |
| 143 // The given URL may be a partial URL (including at least the host) | 144 // The given URL may be a partial URL (including at least the host) |
| 144 // or a full URL to a page. | 145 // or a full URL to a page. |
| 145 // | 146 // |
| 146 // Note that the unblocking API must be part of the content API | 147 // Note that the unblocking API must be part of the content API |
| 147 // because it is called from Chrome side code. | 148 // because it is called from Chrome side code. |
| 148 void BlockDomainFrom3DAPIs(const GURL& url, DomainGuilt guilt); | 149 void BlockDomainFrom3DAPIs(const GURL& url, DomainGuilt guilt); |
| 149 DomainBlockStatus Are3DAPIsBlocked(const GURL& url) const; | 150 bool Are3DAPIsBlocked(const GURL& url, |
| 151 int render_process_id, |
| 152 int render_view_id, |
| 153 ThreeDAPIType requester); |
| 150 | 154 |
| 151 // Disables domain blocking for 3D APIs. For use only in tests. | 155 // Disables domain blocking for 3D APIs. For use only in tests. |
| 152 void DisableDomainBlockingFor3DAPIsForTesting(); | 156 void DisableDomainBlockingFor3DAPIsForTesting(); |
| 153 | 157 |
| 154 private: | 158 private: |
| 155 struct DomainBlockEntry { | 159 struct DomainBlockEntry { |
| 156 DomainGuilt last_guilt; | 160 DomainGuilt last_guilt; |
| 157 }; | 161 }; |
| 158 | 162 |
| 159 typedef std::map<std::string, DomainBlockEntry> DomainBlockMap; | 163 typedef std::map<std::string, DomainBlockEntry> DomainBlockMap; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 std::string GetDomainFromURL(const GURL& url) const; | 215 std::string GetDomainFromURL(const GURL& url) const; |
| 212 | 216 |
| 213 // Implementation functions for blocking of 3D graphics APIs, used | 217 // Implementation functions for blocking of 3D graphics APIs, used |
| 214 // for unit testing. | 218 // for unit testing. |
| 215 void BlockDomainFrom3DAPIsAtTime( | 219 void BlockDomainFrom3DAPIsAtTime( |
| 216 const GURL& url, DomainGuilt guilt, base::Time at_time); | 220 const GURL& url, DomainGuilt guilt, base::Time at_time); |
| 217 DomainBlockStatus Are3DAPIsBlockedAtTime( | 221 DomainBlockStatus Are3DAPIsBlockedAtTime( |
| 218 const GURL& url, base::Time at_time) const; | 222 const GURL& url, base::Time at_time) const; |
| 219 int64 GetBlockAllDomainsDurationInMs() const; | 223 int64 GetBlockAllDomainsDurationInMs() const; |
| 220 | 224 |
| 225 void Notify3DAPIBlocked(const GURL& url, |
| 226 int render_process_id, |
| 227 int render_view_id, |
| 228 ThreeDAPIType requester); |
| 229 |
| 221 bool complete_gpu_info_already_requested_; | 230 bool complete_gpu_info_already_requested_; |
| 222 | 231 |
| 223 GpuFeatureType blacklisted_features_; | 232 GpuFeatureType blacklisted_features_; |
| 224 GpuFeatureType preliminary_blacklisted_features_; | 233 GpuFeatureType preliminary_blacklisted_features_; |
| 225 | 234 |
| 226 GpuSwitchingOption gpu_switching_; | 235 GpuSwitchingOption gpu_switching_; |
| 227 | 236 |
| 228 GPUInfo gpu_info_; | 237 GPUInfo gpu_info_; |
| 229 mutable base::Lock gpu_info_lock_; | 238 mutable base::Lock gpu_info_lock_; |
| 230 | 239 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 253 DomainBlockMap blocked_domains_; | 262 DomainBlockMap blocked_domains_; |
| 254 mutable std::list<base::Time> timestamps_of_gpu_resets_; | 263 mutable std::list<base::Time> timestamps_of_gpu_resets_; |
| 255 bool domain_blocking_enabled_; | 264 bool domain_blocking_enabled_; |
| 256 | 265 |
| 257 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 266 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
| 258 }; | 267 }; |
| 259 | 268 |
| 260 } // namespace content | 269 } // namespace content |
| 261 | 270 |
| 262 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 271 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
| OLD | NEW |