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

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

Issue 2802663002: GpuProcessHost: setup ipc to propagate supported GpuMemoryBufferAttribs
Patch Set: check for pending calls, rename get_supported_gpu_memory_buffer_attribs_requests_ Created 3 years, 8 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
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); 710 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
711 711
712 DCHECK(CalledOnValidThread()); 712 DCHECK(CalledOnValidThread());
713 create_gpu_memory_buffer_requests_.push(callback); 713 create_gpu_memory_buffer_requests_.push(callback);
714 gpu_service_ptr_->CreateGpuMemoryBuffer( 714 gpu_service_ptr_->CreateGpuMemoryBuffer(
715 id, size, format, usage, client_id, surface_handle, 715 id, size, format, usage, client_id, surface_handle,
716 base::Bind(&GpuProcessHost::OnGpuMemoryBufferCreated, 716 base::Bind(&GpuProcessHost::OnGpuMemoryBufferCreated,
717 weak_ptr_factory_.GetWeakPtr())); 717 weak_ptr_factory_.GetWeakPtr()));
718 } 718 }
719 719
720 void GpuProcessHost::GetGpuMemoryBufferAttribs(
721 const GetGpuMemoryBufferAttribsCallback& callback) {
722 TRACE_EVENT0("gpu", "GpuProcessHost::GetGpuMemoryBufferAttribs");
723
724 DCHECK(CalledOnValidThread());
725
726 get_gpu_memory_buffer_attribs_requests_.push(callback);
727
728 if (get_gpu_memory_buffer_attribs_requests_.size() > 1)
729 return;
730
731 gpu_service_ptr_->GetGpuMemoryBufferAttribs(
732 base::Bind(&GpuProcessHost::OnGpuMemoryBufferAttribsReceived,
733 weak_ptr_factory_.GetWeakPtr()));
734 }
735
720 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 736 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
721 int client_id, 737 int client_id,
722 const gpu::SyncToken& sync_token) { 738 const gpu::SyncToken& sync_token) {
723 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); 739 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer");
724 gpu_service_ptr_->DestroyGpuMemoryBuffer(id, client_id, sync_token); 740 gpu_service_ptr_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
725 } 741 }
726 742
727 #if defined(OS_ANDROID) 743 #if defined(OS_ANDROID)
728 void GpuProcessHost::SendDestroyingVideoSurface(int surface_id, 744 void GpuProcessHost::SendDestroyingVideoSurface(int surface_id,
729 const base::Closure& done_cb) { 745 const base::Closure& done_cb) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 789 }
774 790
775 #if defined(OS_ANDROID) 791 #if defined(OS_ANDROID)
776 void GpuProcessHost::OnDestroyingVideoSurfaceAck() { 792 void GpuProcessHost::OnDestroyingVideoSurfaceAck() {
777 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyingVideoSurfaceAck"); 793 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyingVideoSurfaceAck");
778 if (!send_destroying_video_surface_done_cb_.is_null()) 794 if (!send_destroying_video_surface_done_cb_.is_null())
779 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run(); 795 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
780 } 796 }
781 #endif 797 #endif
782 798
799 void GpuProcessHost::OnGpuMemoryBufferAttribsReceived(
800 const gfx::GpuMemoryBufferAttribVector& supported_attribs) {
801 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferAttribsReceived");
802
803 while (!get_gpu_memory_buffer_attribs_requests_.empty()) {
804 auto callback = get_gpu_memory_buffer_attribs_requests_.front();
805 get_gpu_memory_buffer_attribs_requests_.pop();
806 callback.Run(supported_attribs);
807 }
808 }
809
783 void GpuProcessHost::OnProcessLaunched() { 810 void GpuProcessHost::OnProcessLaunched() {
784 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", 811 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime",
785 base::TimeTicks::Now() - init_start_time_); 812 base::TimeTicks::Now() - init_start_time_);
786 } 813 }
787 814
788 void GpuProcessHost::OnProcessLaunchFailed(int error_code) { 815 void GpuProcessHost::OnProcessLaunchFailed(int error_code) {
789 // TODO(wfh): do something more useful with this error code. 816 // TODO(wfh): do something more useful with this error code.
790 RecordProcessCrash(); 817 RecordProcessCrash();
791 } 818 }
792 819
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 EstablishChannelStatus::GPU_HOST_INVALID); 1078 EstablishChannelStatus::GPU_HOST_INVALID);
1052 } 1079 }
1053 1080
1054 while (!create_gpu_memory_buffer_requests_.empty()) { 1081 while (!create_gpu_memory_buffer_requests_.empty()) {
1055 auto callback = create_gpu_memory_buffer_requests_.front(); 1082 auto callback = create_gpu_memory_buffer_requests_.front();
1056 create_gpu_memory_buffer_requests_.pop(); 1083 create_gpu_memory_buffer_requests_.pop();
1057 callback.Run(gfx::GpuMemoryBufferHandle(), 1084 callback.Run(gfx::GpuMemoryBufferHandle(),
1058 BufferCreationStatus::GPU_HOST_INVALID); 1085 BufferCreationStatus::GPU_HOST_INVALID);
1059 } 1086 }
1060 1087
1088 while (!get_gpu_memory_buffer_attribs_requests_.empty()) {
1089 auto callback = get_gpu_memory_buffer_attribs_requests_.front();
1090 get_gpu_memory_buffer_attribs_requests_.pop();
1091 callback.Run(gfx::GpuMemoryBufferAttribVector());
1092 }
1093
1061 if (!send_destroying_video_surface_done_cb_.is_null()) 1094 if (!send_destroying_video_surface_done_cb_.is_null())
1062 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run(); 1095 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
1063 } 1096 }
1064 1097
1065 void GpuProcessHost::BlockLiveOffscreenContexts() { 1098 void GpuProcessHost::BlockLiveOffscreenContexts() {
1066 for (std::multiset<GURL>::iterator iter = 1099 for (std::multiset<GURL>::iterator iter =
1067 urls_with_live_offscreen_contexts_.begin(); 1100 urls_with_live_offscreen_contexts_.begin();
1068 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1101 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1069 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1102 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1070 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1103 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 if (!cache.get()) 1214 if (!cache.get())
1182 return; 1215 return;
1183 1216
1184 cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader, 1217 cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader,
1185 weak_ptr_factory_.GetWeakPtr())); 1218 weak_ptr_factory_.GetWeakPtr()));
1186 1219
1187 client_id_to_shader_cache_[client_id] = cache; 1220 client_id_to_shader_cache_[client_id] = cache;
1188 } 1221 }
1189 1222
1190 } // namespace content 1223 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698