Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1703163002: Remove dependency on GURL from content/common/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 817
818 if (create_gpu_memory_buffer_requests_.empty()) 818 if (create_gpu_memory_buffer_requests_.empty())
819 return; 819 return;
820 820
821 CreateGpuMemoryBufferCallback callback = 821 CreateGpuMemoryBufferCallback callback =
822 create_gpu_memory_buffer_requests_.front(); 822 create_gpu_memory_buffer_requests_.front();
823 create_gpu_memory_buffer_requests_.pop(); 823 create_gpu_memory_buffer_requests_.pop();
824 callback.Run(handle); 824 callback.Run(handle);
825 } 825 }
826 826
827 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { 827 void GpuProcessHost::OnDidCreateOffscreenContext(const std::string& url) {
828 urls_with_live_offscreen_contexts_.insert(url); 828 urls_with_live_offscreen_contexts_.insert(GURL(url));
829 } 829 }
830 830
831 void GpuProcessHost::OnDidLoseContext(bool offscreen, 831 void GpuProcessHost::OnDidLoseContext(bool offscreen,
832 gpu::error::ContextLostReason reason, 832 gpu::error::ContextLostReason reason,
833 const GURL& url) { 833 const std::string& url) {
834 const GURL gurl(url);
834 // TODO(kbr): would be nice to see the "offscreen" flag too. 835 // TODO(kbr): would be nice to see the "offscreen" flag too.
835 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", 836 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", "reason", reason,
836 "reason", reason, 837 "url", gurl.possibly_invalid_spec());
837 "url",
838 url.possibly_invalid_spec());
839 838
840 if (!offscreen || url.is_empty()) { 839 if (!offscreen || gurl.is_empty()) {
841 // Assume that the loss of the compositor's or accelerated canvas' 840 // Assume that the loss of the compositor's or accelerated canvas'
842 // context is a serious event and blame the loss on all live 841 // context is a serious event and blame the loss on all live
843 // offscreen contexts. This more robustly handles situations where 842 // offscreen contexts. This more robustly handles situations where
844 // the GPU process may not actually detect the context loss in the 843 // the GPU process may not actually detect the context loss in the
845 // offscreen context. 844 // offscreen context.
846 BlockLiveOffscreenContexts(); 845 BlockLiveOffscreenContexts();
847 return; 846 return;
848 } 847 }
849 848
850 GpuDataManagerImpl::DomainGuilt guilt; 849 GpuDataManagerImpl::DomainGuilt guilt;
851 switch (reason) { 850 switch (reason) {
852 case gpu::error::kGuilty: 851 case gpu::error::kGuilty:
853 guilt = GpuDataManagerImpl::DOMAIN_GUILT_KNOWN; 852 guilt = GpuDataManagerImpl::DOMAIN_GUILT_KNOWN;
854 break; 853 break;
855 case gpu::error::kUnknown: 854 case gpu::error::kUnknown:
856 guilt = GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN; 855 guilt = GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN;
857 break; 856 break;
858 case gpu::error::kInnocent: 857 case gpu::error::kInnocent:
859 return; 858 return;
860 default: 859 default:
861 NOTREACHED(); 860 NOTREACHED();
862 return; 861 return;
863 } 862 }
864 863
865 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(url, guilt); 864 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(gurl, guilt);
piman 2016/02/18 18:29:28 Oh, I hadn't realized we used the URL to extract t
Mark Dittmer 2016/02/18 21:10:25 If GURL is stored on either end, and spec() is use
866 } 865 }
867 866
868 void GpuProcessHost::OnDidDestroyOffscreenContext(const GURL& url) { 867 void GpuProcessHost::OnDidDestroyOffscreenContext(const std::string& url) {
869 urls_with_live_offscreen_contexts_.erase(url); 868 urls_with_live_offscreen_contexts_.erase(GURL(url));
870 } 869 }
871 870
872 void GpuProcessHost::OnGpuMemoryUmaStatsReceived( 871 void GpuProcessHost::OnGpuMemoryUmaStatsReceived(
873 const GPUMemoryUmaStats& stats) { 872 const GPUMemoryUmaStats& stats) {
874 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryUmaStatsReceived"); 873 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryUmaStatsReceived");
875 uma_memory_stats_received_ = true; 874 uma_memory_stats_received_ = true;
876 uma_memory_stats_ = stats; 875 uma_memory_stats_ = stats;
877 } 876 }
878 877
879 #if defined(OS_MACOSX) 878 #if defined(OS_MACOSX)
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1146 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1148 ClientIdToShaderCacheMap::iterator iter = 1147 ClientIdToShaderCacheMap::iterator iter =
1149 client_id_to_shader_cache_.find(client_id); 1148 client_id_to_shader_cache_.find(client_id);
1150 // If the cache doesn't exist then this is an off the record profile. 1149 // If the cache doesn't exist then this is an off the record profile.
1151 if (iter == client_id_to_shader_cache_.end()) 1150 if (iter == client_id_to_shader_cache_.end())
1152 return; 1151 return;
1153 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1152 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1154 } 1153 }
1155 1154
1156 } // namespace content 1155 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698