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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 Send(new GpuMsg_CreateViewCommandBuffer( | 641 Send(new GpuMsg_CreateViewCommandBuffer( |
642 compositing_surface, surface_id, client_id, init_params, route_id))) { | 642 compositing_surface, surface_id, client_id, init_params, route_id))) { |
643 create_command_buffer_requests_.push(callback); | 643 create_command_buffer_requests_.push(callback); |
644 surface_refs_.insert(std::make_pair(surface_id, | 644 surface_refs_.insert(std::make_pair(surface_id, |
645 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id))); | 645 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id))); |
646 } else { | 646 } else { |
647 callback.Run(false); | 647 callback.Run(false); |
648 } | 648 } |
649 } | 649 } |
650 | 650 |
651 void GpuProcessHost::CreateImage(gfx::PluginWindowHandle window, | 651 void GpuProcessHost::CreateImage(const gfx::GpuMemoryBufferHandle& handle, |
| 652 const gfx::Size& size, |
| 653 unsigned internalformat, |
652 int client_id, | 654 int client_id, |
653 int image_id, | 655 int image_id, |
654 const CreateImageCallback& callback) { | 656 const CreateImageCallback& callback) { |
655 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage"); | 657 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage"); |
656 | 658 |
657 DCHECK(CalledOnValidThread()); | 659 DCHECK(CalledOnValidThread()); |
658 | 660 |
659 if (Send(new GpuMsg_CreateImage(window, client_id, image_id))) { | 661 if (Send(new GpuMsg_CreateImage( |
| 662 handle, size, internalformat, client_id, image_id))) { |
660 create_image_requests_.push(callback); | 663 create_image_requests_.push(callback); |
661 } else { | 664 } else { |
662 callback.Run(gfx::Size()); | 665 callback.Run(false); |
663 } | 666 } |
664 } | 667 } |
665 | 668 |
666 void GpuProcessHost::DeleteImage(int client_id, | 669 void GpuProcessHost::DeleteImage(int client_id, |
667 int image_id, | 670 int image_id, |
668 int sync_point) { | 671 int sync_point) { |
669 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage"); | 672 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage"); |
670 | 673 |
671 DCHECK(CalledOnValidThread()); | 674 DCHECK(CalledOnValidThread()); |
672 | 675 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 } | 759 } |
757 | 760 |
758 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { | 761 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { |
759 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer"); | 762 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer"); |
760 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); | 763 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); |
761 if (it != surface_refs_.end()) { | 764 if (it != surface_refs_.end()) { |
762 surface_refs_.erase(it); | 765 surface_refs_.erase(it); |
763 } | 766 } |
764 } | 767 } |
765 | 768 |
766 void GpuProcessHost::OnImageCreated(const gfx::Size size) { | 769 void GpuProcessHost::OnImageCreated(bool succeeded) { |
767 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated"); | 770 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated"); |
768 | 771 |
769 if (create_image_requests_.empty()) | 772 if (create_image_requests_.empty()) |
770 return; | 773 return; |
771 | 774 |
772 CreateImageCallback callback = create_image_requests_.front(); | 775 CreateImageCallback callback = create_image_requests_.front(); |
773 create_image_requests_.pop(); | 776 create_image_requests_.pop(); |
774 callback.Run(size); | 777 callback.Run(succeeded); |
775 } | 778 } |
776 | 779 |
777 void GpuProcessHost::OnGpuMemoryBufferCreated( | 780 void GpuProcessHost::OnGpuMemoryBufferCreated( |
778 const gfx::GpuMemoryBufferHandle& handle) { | 781 const gfx::GpuMemoryBufferHandle& handle) { |
779 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); | 782 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); |
780 | 783 |
781 if (create_gpu_memory_buffer_requests_.empty()) | 784 if (create_gpu_memory_buffer_requests_.empty()) |
782 return; | 785 return; |
783 | 786 |
784 CreateGpuMemoryBufferCallback callback = | 787 CreateGpuMemoryBufferCallback callback = |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1115 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1113 ClientIdToShaderCacheMap::iterator iter = | 1116 ClientIdToShaderCacheMap::iterator iter = |
1114 client_id_to_shader_cache_.find(client_id); | 1117 client_id_to_shader_cache_.find(client_id); |
1115 // If the cache doesn't exist then this is an off the record profile. | 1118 // If the cache doesn't exist then this is an off the record profile. |
1116 if (iter == client_id_to_shader_cache_.end()) | 1119 if (iter == client_id_to_shader_cache_.end()) |
1117 return; | 1120 return; |
1118 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1121 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1119 } | 1122 } |
1120 | 1123 |
1121 } // namespace content | 1124 } // namespace content |
OLD | NEW |