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

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: crown of aragorn 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 Send(new GpuMsg_CreateViewCommandBuffer( 642 Send(new GpuMsg_CreateViewCommandBuffer(
644 compositing_surface, surface_id, client_id, init_params, route_id))) { 643 compositing_surface, surface_id, client_id, init_params, route_id))) {
645 create_command_buffer_requests_.push(callback); 644 create_command_buffer_requests_.push(callback);
646 surface_refs_.insert(std::make_pair(surface_id, 645 surface_refs_.insert(std::make_pair(surface_id,
647 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id))); 646 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id)));
648 } else { 647 } else {
649 callback.Run(false); 648 callback.Run(false);
650 } 649 }
651 } 650 }
652 651
653 void GpuProcessHost::CreateImage(gfx::PluginWindowHandle window,
654 int client_id,
655 int image_id,
656 const CreateImageCallback& callback) {
657 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage");
658
659 DCHECK(CalledOnValidThread());
660
661 if (Send(new GpuMsg_CreateImage(window, client_id, image_id))) {
662 create_image_requests_.push(callback);
663 } else {
664 callback.Run(gfx::Size());
665 }
666 }
667
668 void GpuProcessHost::DeleteImage(int client_id,
669 int image_id,
670 int sync_point) {
671 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage");
672
673 DCHECK(CalledOnValidThread());
674
675 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point));
676 }
677
678 void GpuProcessHost::CreateGpuMemoryBuffer( 652 void GpuProcessHost::CreateGpuMemoryBuffer(
679 const gfx::GpuMemoryBufferHandle& handle, 653 const gfx::GpuMemoryBufferHandle& handle,
680 const gfx::Size& size, 654 const gfx::Size& size,
681 unsigned internalformat, 655 unsigned internalformat,
682 unsigned usage, 656 unsigned usage,
683 const CreateGpuMemoryBufferCallback& callback) { 657 const CreateGpuMemoryBufferCallback& callback) {
684 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); 658 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
685 659
686 DCHECK(CalledOnValidThread()); 660 DCHECK(CalledOnValidThread());
687 661
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 } 732 }
759 733
760 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { 734 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
761 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer"); 735 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer");
762 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 736 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
763 if (it != surface_refs_.end()) { 737 if (it != surface_refs_.end()) {
764 surface_refs_.erase(it); 738 surface_refs_.erase(it);
765 } 739 }
766 } 740 }
767 741
768 void GpuProcessHost::OnImageCreated(const gfx::Size size) {
769 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated");
770
771 if (create_image_requests_.empty())
772 return;
773
774 CreateImageCallback callback = create_image_requests_.front();
775 create_image_requests_.pop();
776 callback.Run(size);
777 }
778
779 void GpuProcessHost::OnGpuMemoryBufferCreated( 742 void GpuProcessHost::OnGpuMemoryBufferCreated(
780 const gfx::GpuMemoryBufferHandle& handle) { 743 const gfx::GpuMemoryBufferHandle& handle) {
781 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); 744 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated");
782 745
783 if (create_gpu_memory_buffer_requests_.empty()) 746 if (create_gpu_memory_buffer_requests_.empty())
784 return; 747 return;
785 748
786 CreateGpuMemoryBufferCallback callback = 749 CreateGpuMemoryBufferCallback callback =
787 create_gpu_memory_buffer_requests_.front(); 750 create_gpu_memory_buffer_requests_.front();
788 create_gpu_memory_buffer_requests_.pop(); 751 create_gpu_memory_buffer_requests_.pop();
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1102 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1140 ClientIdToShaderCacheMap::iterator iter = 1103 ClientIdToShaderCacheMap::iterator iter =
1141 client_id_to_shader_cache_.find(client_id); 1104 client_id_to_shader_cache_.find(client_id);
1142 // If the cache doesn't exist then this is an off the record profile. 1105 // If the cache doesn't exist then this is an off the record profile.
1143 if (iter == client_id_to_shader_cache_.end()) 1106 if (iter == client_id_to_shader_cache_.end())
1144 return; 1107 return;
1145 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1108 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1146 } 1109 }
1147 1110
1148 } // namespace content 1111 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698