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 #include "content/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 if (!offscreen || url.is_empty()) { | 872 if (!offscreen || url.is_empty()) { |
873 // Assume that the loss of the compositor's or accelerated canvas' | 873 // Assume that the loss of the compositor's or accelerated canvas' |
874 // context is a serious event and blame the loss on all live | 874 // context is a serious event and blame the loss on all live |
875 // offscreen contexts. This more robustly handles situations where | 875 // offscreen contexts. This more robustly handles situations where |
876 // the GPU process may not actually detect the context loss in the | 876 // the GPU process may not actually detect the context loss in the |
877 // offscreen context. | 877 // offscreen context. |
878 BlockLiveOffscreenContexts(); | 878 BlockLiveOffscreenContexts(); |
879 return; | 879 return; |
880 } | 880 } |
881 | 881 |
882 GpuDataManagerImpl::DomainGuilt guilt; | 882 GpuDataManagerImpl::DomainGuilt guilt = |
| 883 GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN; |
883 switch (reason) { | 884 switch (reason) { |
884 case gpu::error::kGuilty: | 885 case gpu::error::kGuilty: |
885 guilt = GpuDataManagerImpl::DOMAIN_GUILT_KNOWN; | 886 guilt = GpuDataManagerImpl::DOMAIN_GUILT_KNOWN; |
886 break; | 887 break; |
| 888 // Treat most other error codes as though they had unknown provenance. |
| 889 // In practice this doesn't affect the user experience. A lost context |
| 890 // of either known or unknown guilt still causes user-level 3D APIs |
| 891 // (e.g. WebGL) to be blocked on that domain until the user manually |
| 892 // reenables them. |
887 case gpu::error::kUnknown: | 893 case gpu::error::kUnknown: |
888 guilt = GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN; | 894 case gpu::error::kOutOfMemory: |
| 895 case gpu::error::kMakeCurrentFailed: |
| 896 case gpu::error::kGpuChannelLost: |
| 897 case gpu::error::kInvalidGpuMessage: |
889 break; | 898 break; |
890 case gpu::error::kInnocent: | 899 case gpu::error::kInnocent: |
891 return; | 900 return; |
892 default: | |
893 NOTREACHED(); | |
894 return; | |
895 } | 901 } |
896 | 902 |
897 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(url, guilt); | 903 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(url, guilt); |
898 } | 904 } |
899 | 905 |
900 void GpuProcessHost::OnDidDestroyOffscreenContext(const GURL& url) { | 906 void GpuProcessHost::OnDidDestroyOffscreenContext(const GURL& url) { |
901 urls_with_live_offscreen_contexts_.erase(url); | 907 urls_with_live_offscreen_contexts_.erase(url); |
902 } | 908 } |
903 | 909 |
904 void GpuProcessHost::OnGpuMemoryUmaStatsReceived( | 910 void GpuProcessHost::OnGpuMemoryUmaStatsReceived( |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1178 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1173 ClientIdToShaderCacheMap::iterator iter = | 1179 ClientIdToShaderCacheMap::iterator iter = |
1174 client_id_to_shader_cache_.find(client_id); | 1180 client_id_to_shader_cache_.find(client_id); |
1175 // If the cache doesn't exist then this is an off the record profile. | 1181 // If the cache doesn't exist then this is an off the record profile. |
1176 if (iter == client_id_to_shader_cache_.end()) | 1182 if (iter == client_id_to_shader_cache_.end()) |
1177 return; | 1183 return; |
1178 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1184 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1179 } | 1185 } |
1180 | 1186 |
1181 } // namespace content | 1187 } // namespace content |
OLD | NEW |