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

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: wip 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 process_->GetHost()->AddFilter(filter); 558 process_->GetHost()->AddFilter(filter);
559 } 559 }
560 560
561 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 561 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
562 DCHECK(CalledOnValidThread()); 562 DCHECK(CalledOnValidThread());
563 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 563 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
564 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized) 564 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized)
565 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 565 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
566 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) 566 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
567 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) 567 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer)
568 IPC_MESSAGE_HANDLER(GpuHostMsg_ImageCreated, OnImageCreated)
569 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, 568 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
570 OnGpuMemoryBufferCreated) 569 OnGpuMemoryBufferCreated)
571 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, 570 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext,
572 OnDidCreateOffscreenContext) 571 OnDidCreateOffscreenContext)
573 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) 572 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
574 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, 573 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext,
575 OnDidDestroyOffscreenContext) 574 OnDidDestroyOffscreenContext)
576 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 575 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
577 OnGpuMemoryUmaStatsReceived) 576 OnGpuMemoryUmaStatsReceived)
578 #if defined(OS_MACOSX) 577 #if defined(OS_MACOSX)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 Send(new GpuMsg_CreateViewCommandBuffer( 640 Send(new GpuMsg_CreateViewCommandBuffer(
642 compositing_surface, surface_id, client_id, init_params, route_id))) { 641 compositing_surface, surface_id, client_id, init_params, route_id))) {
643 create_command_buffer_requests_.push(callback); 642 create_command_buffer_requests_.push(callback);
644 surface_refs_.insert(std::make_pair(surface_id, 643 surface_refs_.insert(std::make_pair(surface_id,
645 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id))); 644 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id)));
646 } else { 645 } else {
647 callback.Run(false); 646 callback.Run(false);
648 } 647 }
649 } 648 }
650 649
651 void GpuProcessHost::CreateImage(gfx::PluginWindowHandle window,
652 int client_id,
653 int image_id,
654 const CreateImageCallback& callback) {
655 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage");
656
657 DCHECK(CalledOnValidThread());
658
659 if (Send(new GpuMsg_CreateImage(window, client_id, image_id))) {
660 create_image_requests_.push(callback);
661 } else {
662 callback.Run(gfx::Size());
663 }
664 }
665
666 void GpuProcessHost::DeleteImage(int client_id,
667 int image_id,
668 int sync_point) {
669 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage");
670
671 DCHECK(CalledOnValidThread());
672
673 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point));
674 }
675
676 void GpuProcessHost::CreateGpuMemoryBuffer( 650 void GpuProcessHost::CreateGpuMemoryBuffer(
677 const gfx::GpuMemoryBufferHandle& handle, 651 const gfx::GpuMemoryBufferHandle& handle,
678 const gfx::Size& size, 652 const gfx::Size& size,
679 unsigned internalformat, 653 unsigned internalformat,
680 unsigned usage, 654 unsigned usage,
681 const CreateGpuMemoryBufferCallback& callback) { 655 const CreateGpuMemoryBufferCallback& callback) {
682 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); 656 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
683 657
684 DCHECK(CalledOnValidThread()); 658 DCHECK(CalledOnValidThread());
685 659
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 730 }
757 731
758 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { 732 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
759 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer"); 733 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer");
760 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 734 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
761 if (it != surface_refs_.end()) { 735 if (it != surface_refs_.end()) {
762 surface_refs_.erase(it); 736 surface_refs_.erase(it);
763 } 737 }
764 } 738 }
765 739
766 void GpuProcessHost::OnImageCreated(const gfx::Size size) {
767 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated");
768
769 if (create_image_requests_.empty())
770 return;
771
772 CreateImageCallback callback = create_image_requests_.front();
773 create_image_requests_.pop();
774 callback.Run(size);
775 }
776
777 void GpuProcessHost::OnGpuMemoryBufferCreated( 740 void GpuProcessHost::OnGpuMemoryBufferCreated(
778 const gfx::GpuMemoryBufferHandle& handle) { 741 const gfx::GpuMemoryBufferHandle& handle) {
779 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); 742 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated");
780 743
781 if (create_gpu_memory_buffer_requests_.empty()) 744 if (create_gpu_memory_buffer_requests_.empty())
782 return; 745 return;
783 746
784 CreateGpuMemoryBufferCallback callback = 747 CreateGpuMemoryBufferCallback callback =
785 create_gpu_memory_buffer_requests_.front(); 748 create_gpu_memory_buffer_requests_.front();
786 create_gpu_memory_buffer_requests_.pop(); 749 create_gpu_memory_buffer_requests_.pop();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1075 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1113 ClientIdToShaderCacheMap::iterator iter = 1076 ClientIdToShaderCacheMap::iterator iter =
1114 client_id_to_shader_cache_.find(client_id); 1077 client_id_to_shader_cache_.find(client_id);
1115 // If the cache doesn't exist then this is an off the record profile. 1078 // If the cache doesn't exist then this is an off the record profile.
1116 if (iter == client_id_to_shader_cache_.end()) 1079 if (iter == client_id_to_shader_cache_.end())
1117 return; 1080 return;
1118 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1081 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1119 } 1082 }
1120 1083
1121 } // namespace content 1084 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698