| 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 "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 void GpuProcessHost::DeleteImage(int client_id, | 757 void GpuProcessHost::DeleteImage(int client_id, |
| 758 int image_id, | 758 int image_id, |
| 759 int sync_point) { | 759 int sync_point) { |
| 760 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage"); | 760 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage"); |
| 761 | 761 |
| 762 DCHECK(CalledOnValidThread()); | 762 DCHECK(CalledOnValidThread()); |
| 763 | 763 |
| 764 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point)); | 764 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point)); |
| 765 } | 765 } |
| 766 | 766 |
| 767 void GpuProcessHost::CreateSurfaceTexture( |
| 768 int surface_texture_id, |
| 769 base::ProcessHandle process_handle, |
| 770 const CreateSurfaceTextureCallback& callback) { |
| 771 TRACE_EVENT0("gpu", "GpuProcessHost::CreateSurfaceTexture"); |
| 772 |
| 773 DCHECK(CalledOnValidThread()); |
| 774 |
| 775 if (Send(new GpuMsg_CreateSurfaceTexture(surface_texture_id, |
| 776 process_handle))) { |
| 777 create_surface_texture_requests_.push(callback); |
| 778 } else { |
| 779 callback.Run(); |
| 780 } |
| 781 } |
| 782 |
| 767 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { | 783 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { |
| 768 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); | 784 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
| 769 initialized_ = result; | 785 initialized_ = result; |
| 770 | 786 |
| 771 if (!initialized_) | 787 if (!initialized_) |
| 772 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); | 788 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); |
| 773 else if (!in_process_) | 789 else if (!in_process_) |
| 774 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 790 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
| 775 } | 791 } |
| 776 | 792 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated"); | 846 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated"); |
| 831 | 847 |
| 832 if (create_image_requests_.empty()) | 848 if (create_image_requests_.empty()) |
| 833 return; | 849 return; |
| 834 | 850 |
| 835 CreateImageCallback callback = create_image_requests_.front(); | 851 CreateImageCallback callback = create_image_requests_.front(); |
| 836 create_image_requests_.pop(); | 852 create_image_requests_.pop(); |
| 837 callback.Run(size); | 853 callback.Run(size); |
| 838 } | 854 } |
| 839 | 855 |
| 856 void GpuProcessHost::OnSurfaceTextureCreated() { |
| 857 TRACE_EVENT0("gpu", "GpuProcessHost::OnSurfaceTextureCreated"); |
| 858 |
| 859 if (create_surface_texture_requests_.empty()) |
| 860 return; |
| 861 |
| 862 CreateSurfaceTextureCallback callback = |
| 863 create_surface_texture_requests_.front(); |
| 864 create_surface_texture_requests_.pop(); |
| 865 callback.Run(); |
| 866 } |
| 867 |
| 840 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { | 868 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { |
| 841 urls_with_live_offscreen_contexts_.insert(url); | 869 urls_with_live_offscreen_contexts_.insert(url); |
| 842 } | 870 } |
| 843 | 871 |
| 844 void GpuProcessHost::OnDidLoseContext(bool offscreen, | 872 void GpuProcessHost::OnDidLoseContext(bool offscreen, |
| 845 gpu::error::ContextLostReason reason, | 873 gpu::error::ContextLostReason reason, |
| 846 const GURL& url) { | 874 const GURL& url) { |
| 847 // TODO(kbr): would be nice to see the "offscreen" flag too. | 875 // TODO(kbr): would be nice to see the "offscreen" flag too. |
| 848 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", | 876 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", |
| 849 "reason", reason, | 877 "reason", reason, |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1266 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1239 ClientIdToShaderCacheMap::iterator iter = | 1267 ClientIdToShaderCacheMap::iterator iter = |
| 1240 client_id_to_shader_cache_.find(client_id); | 1268 client_id_to_shader_cache_.find(client_id); |
| 1241 // If the cache doesn't exist then this is an off the record profile. | 1269 // If the cache doesn't exist then this is an off the record profile. |
| 1242 if (iter == client_id_to_shader_cache_.end()) | 1270 if (iter == client_id_to_shader_cache_.end()) |
| 1243 return; | 1271 return; |
| 1244 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1272 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1245 } | 1273 } |
| 1246 | 1274 |
| 1247 } // namespace content | 1275 } // namespace content |
| OLD | NEW |