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

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

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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 | Annotate | Revision Log
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 "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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 process_->GetHost()->AddFilter(filter); 564 process_->GetHost()->AddFilter(filter);
565 } 565 }
566 566
567 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 567 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
568 DCHECK(CalledOnValidThread()); 568 DCHECK(CalledOnValidThread());
569 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 569 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
570 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized) 570 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized)
571 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 571 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
572 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) 572 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
573 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) 573 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer)
574 IPC_MESSAGE_HANDLER(GpuHostMsg_ImageCreated, OnImageCreated)
575 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, 574 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
576 OnGpuMemoryBufferCreated) 575 OnGpuMemoryBufferCreated)
577 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, 576 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext,
578 OnDidCreateOffscreenContext) 577 OnDidCreateOffscreenContext)
579 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) 578 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
580 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, 579 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext,
581 OnDidDestroyOffscreenContext) 580 OnDidDestroyOffscreenContext)
582 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 581 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
583 OnGpuMemoryUmaStatsReceived) 582 OnGpuMemoryUmaStatsReceived)
584 #if defined(OS_MACOSX) 583 #if defined(OS_MACOSX)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 create_command_buffer_requests_.push(callback); 650 create_command_buffer_requests_.push(callback);
652 surface_refs_.insert(std::make_pair(surface_id, 651 surface_refs_.insert(std::make_pair(surface_id,
653 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id))); 652 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id)));
654 } else { 653 } else {
655 // Could distinguish here between compositing_surface being NULL 654 // Could distinguish here between compositing_surface being NULL
656 // and Send failing, if desired. 655 // and Send failing, if desired.
657 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST); 656 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST);
658 } 657 }
659 } 658 }
660 659
661 void GpuProcessHost::CreateImage(gfx::PluginWindowHandle window,
662 int client_id,
663 int image_id,
664 const CreateImageCallback& callback) {
665 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage");
666
667 DCHECK(CalledOnValidThread());
668
669 if (Send(new GpuMsg_CreateImage(window, client_id, image_id))) {
670 create_image_requests_.push(callback);
671 } else {
672 callback.Run(gfx::Size());
673 }
674 }
675
676 void GpuProcessHost::DeleteImage(int client_id,
677 int image_id,
678 int sync_point) {
679 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage");
680
681 DCHECK(CalledOnValidThread());
682
683 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point));
684 }
685
686 void GpuProcessHost::CreateGpuMemoryBuffer( 660 void GpuProcessHost::CreateGpuMemoryBuffer(
687 const gfx::GpuMemoryBufferHandle& handle, 661 const gfx::GpuMemoryBufferHandle& handle,
688 const gfx::Size& size, 662 const gfx::Size& size,
689 unsigned internalformat, 663 unsigned internalformat,
690 unsigned usage, 664 unsigned usage,
691 const CreateGpuMemoryBufferCallback& callback) { 665 const CreateGpuMemoryBufferCallback& callback) {
692 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); 666 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
693 667
694 DCHECK(CalledOnValidThread()); 668 DCHECK(CalledOnValidThread());
695 669
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 740 }
767 741
768 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { 742 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
769 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer"); 743 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer");
770 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 744 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
771 if (it != surface_refs_.end()) { 745 if (it != surface_refs_.end()) {
772 surface_refs_.erase(it); 746 surface_refs_.erase(it);
773 } 747 }
774 } 748 }
775 749
776 void GpuProcessHost::OnImageCreated(const gfx::Size size) {
777 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated");
778
779 if (create_image_requests_.empty())
780 return;
781
782 CreateImageCallback callback = create_image_requests_.front();
783 create_image_requests_.pop();
784 callback.Run(size);
785 }
786
787 void GpuProcessHost::OnGpuMemoryBufferCreated( 750 void GpuProcessHost::OnGpuMemoryBufferCreated(
788 const gfx::GpuMemoryBufferHandle& handle) { 751 const gfx::GpuMemoryBufferHandle& handle) {
789 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); 752 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated");
790 753
791 if (create_gpu_memory_buffer_requests_.empty()) 754 if (create_gpu_memory_buffer_requests_.empty())
792 return; 755 return;
793 756
794 CreateGpuMemoryBufferCallback callback = 757 CreateGpuMemoryBufferCallback callback =
795 create_gpu_memory_buffer_requests_.front(); 758 create_gpu_memory_buffer_requests_.front();
796 create_gpu_memory_buffer_requests_.pop(); 759 create_gpu_memory_buffer_requests_.pop();
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1068 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1106 ClientIdToShaderCacheMap::iterator iter = 1069 ClientIdToShaderCacheMap::iterator iter =
1107 client_id_to_shader_cache_.find(client_id); 1070 client_id_to_shader_cache_.find(client_id);
1108 // If the cache doesn't exist then this is an off the record profile. 1071 // If the cache doesn't exist then this is an off the record profile.
1109 if (iter == client_id_to_shader_cache_.end()) 1072 if (iter == client_id_to_shader_cache_.end())
1110 return; 1073 return;
1111 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1074 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1112 } 1075 }
1113 1076
1114 } // namespace content 1077 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698