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

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

Issue 1656433002: Sample code: IPC Transport object for GPU Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GpuMemoryBufferService + Transport object. TODO: Eliminate ChildThreadImpl dependency Created 4 years, 10 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 702
703 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 703 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
704 switches::kDisableGpuShaderDiskCache)) { 704 switches::kDisableGpuShaderDiskCache)) {
705 CreateChannelCache(client_id); 705 CreateChannelCache(client_id);
706 } 706 }
707 } 707 }
708 708
709 void GpuProcessHost::CreateViewCommandBuffer( 709 void GpuProcessHost::CreateViewCommandBuffer(
710 const gfx::GLSurfaceHandle& compositing_surface, 710 const gfx::GLSurfaceHandle& compositing_surface,
711 int client_id, 711 int client_id,
712 const GPUCreateCommandBufferConfig& init_params, 712 const GpuCreateCommandBufferConfig& init_params,
713 int route_id, 713 int route_id,
714 const CreateCommandBufferCallback& callback) { 714 const CreateCommandBufferCallback& callback) {
715 TRACE_EVENT0("gpu", "GpuProcessHost::CreateViewCommandBuffer"); 715 TRACE_EVENT0("gpu", "GpuProcessHost::CreateViewCommandBuffer");
716 716
717 DCHECK(CalledOnValidThread()); 717 DCHECK(CalledOnValidThread());
718 718
719 if (!compositing_surface.is_null() && 719 if (!compositing_surface.is_null() &&
720 Send(new GpuMsg_CreateViewCommandBuffer(compositing_surface, client_id, 720 Send(new GpuMsg_CreateViewCommandBuffer(compositing_surface, client_id,
721 init_params, route_id))) { 721 init_params, route_id))) {
722 create_command_buffer_requests_.push(callback); 722 create_command_buffer_requests_.push(callback);
723 } else { 723 } else {
724 // Could distinguish here between compositing_surface being NULL 724 // Could distinguish here between compositing_surface being NULL
725 // and Send failing, if desired. 725 // and Send failing, if desired.
726 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST); 726 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST);
727 } 727 }
728 } 728 }
729 729
730 void GpuProcessHost::CreateGpuMemoryBuffer( 730 void GpuProcessHost::CreateGpuMemoryBuffer(
731 gfx::GpuMemoryBufferId id, 731 gfx::GpuMemoryBufferId id,
732 const gfx::Size& size, 732 const gfx::Size& size,
733 gfx::BufferFormat format, 733 gfx::BufferFormat format,
734 gfx::BufferUsage usage, 734 gfx::BufferUsage usage,
735 int client_id, 735 int client_id,
736 int32_t surface_id, 736 int32_t surface_id,
737 const CreateGpuMemoryBufferCallback& callback) { 737 const CreateGpuMemoryBufferCallback& callback) {
738 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); 738 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
739 739
740 DCHECK(CalledOnValidThread()); 740 DCHECK(CalledOnValidThread());
741 741
742 GpuMsg_CreateGpuMemoryBuffer_Params params; 742 CreateGpuMemoryBufferParams params;
743 params.id = id; 743 params.id = id;
744 params.size = size; 744 params.size = size;
745 params.format = format; 745 params.format = format;
746 params.usage = usage; 746 params.usage = usage;
747 params.client_id = client_id; 747 params.client_id = client_id;
748 params.surface_handle = 748 params.surface_handle =
749 GpuSurfaceTracker::GetInstance()->GetSurfaceHandle(surface_id).handle; 749 GpuSurfaceTracker::GetInstance()->GetSurfaceHandle(surface_id).handle;
750 if (Send(new GpuMsg_CreateGpuMemoryBuffer(params))) { 750 if (Send(new GpuMsg_CreateGpuMemoryBuffer(params))) {
751 create_gpu_memory_buffer_requests_.push(callback); 751 create_gpu_memory_buffer_requests_.push(callback);
752 } else { 752 } else {
753 callback.Run(gfx::GpuMemoryBufferHandle()); 753 callback.Run(gfx::GpuMemoryBufferHandle());
754 } 754 }
755 } 755 }
756 756
757 void GpuProcessHost::CreateGpuMemoryBufferFromHandle( 757 void GpuProcessHost::CreateGpuMemoryBufferFromHandle(
758 const gfx::GpuMemoryBufferHandle& handle, 758 const gfx::GpuMemoryBufferHandle& handle,
759 gfx::GpuMemoryBufferId id, 759 gfx::GpuMemoryBufferId id,
760 const gfx::Size& size, 760 const gfx::Size& size,
761 gfx::BufferFormat format, 761 gfx::BufferFormat format,
762 int client_id, 762 int client_id,
763 const CreateGpuMemoryBufferCallback& callback) { 763 const CreateGpuMemoryBufferCallback& callback) {
764 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBufferFromHandle"); 764 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBufferFromHandle");
765 765
766 DCHECK(CalledOnValidThread()); 766 DCHECK(CalledOnValidThread());
767 767
768 GpuMsg_CreateGpuMemoryBufferFromHandle_Params params; 768 CreateGpuMemoryBufferFromHandleParams params;
769 params.handle = handle; 769 params.handle = handle;
770 params.id = id; 770 params.id = id;
771 params.size = size; 771 params.size = size;
772 params.format = format; 772 params.format = format;
773 params.client_id = client_id; 773 params.client_id = client_id;
774 if (Send(new GpuMsg_CreateGpuMemoryBufferFromHandle(params))) { 774 if (Send(new GpuMsg_CreateGpuMemoryBufferFromHandle(params))) {
775 create_gpu_memory_buffer_requests_.push(callback); 775 create_gpu_memory_buffer_requests_.push(callback);
776 } else { 776 } else {
777 callback.Run(gfx::GpuMemoryBufferHandle()); 777 callback.Run(gfx::GpuMemoryBufferHandle());
778 } 778 }
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1180 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1181 ClientIdToShaderCacheMap::iterator iter = 1181 ClientIdToShaderCacheMap::iterator iter =
1182 client_id_to_shader_cache_.find(client_id); 1182 client_id_to_shader_cache_.find(client_id);
1183 // If the cache doesn't exist then this is an off the record profile. 1183 // If the cache doesn't exist then this is an off the record profile.
1184 if (iter == client_id_to_shader_cache_.end()) 1184 if (iter == client_id_to_shader_cache_.end())
1185 return; 1185 return;
1186 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1186 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1187 } 1187 }
1188 1188
1189 } // namespace content 1189 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu/client/command_buffer_proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698