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

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

Issue 2802663002: GpuProcessHost: setup ipc to propagate supported GpuMemoryBufferAttribs
Patch Set: GpuProcessHost: setup ipc to propagate supported GpuMemoryBufferAttribs 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_supported_gpu_memory_buffer_attribs_requests_.push(callback);
727 gpu_service_ptr_->GetGpuMemoryBufferAttribs(
sadrul 2017/04/19 21:45:46 Maybe not make another request when a request is a
varad 2017/04/21 13:03:59 Done.
728 base::Bind(&GpuProcessHost::OnGpuMemoryBufferAttribsReceived,
729 weak_ptr_factory_.GetWeakPtr()));
730 }
731
720 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 732 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
721 int client_id, 733 int client_id,
722 const gpu::SyncToken& sync_token) { 734 const gpu::SyncToken& sync_token) {
723 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); 735 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer");
724 gpu_service_ptr_->DestroyGpuMemoryBuffer(id, client_id, sync_token); 736 gpu_service_ptr_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
725 } 737 }
726 738
727 #if defined(OS_ANDROID) 739 #if defined(OS_ANDROID)
728 void GpuProcessHost::SendDestroyingVideoSurface(int surface_id, 740 void GpuProcessHost::SendDestroyingVideoSurface(int surface_id,
729 const base::Closure& done_cb) { 741 const base::Closure& done_cb) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 785 }
774 786
775 #if defined(OS_ANDROID) 787 #if defined(OS_ANDROID)
776 void GpuProcessHost::OnDestroyingVideoSurfaceAck() { 788 void GpuProcessHost::OnDestroyingVideoSurfaceAck() {
777 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyingVideoSurfaceAck"); 789 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyingVideoSurfaceAck");
778 if (!send_destroying_video_surface_done_cb_.is_null()) 790 if (!send_destroying_video_surface_done_cb_.is_null())
779 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run(); 791 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
780 } 792 }
781 #endif 793 #endif
782 794
795 void GpuProcessHost::OnGpuMemoryBufferAttribsReceived(
796 const gfx::GpuMemoryBufferAttribVector& supported_attribs) {
797 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferAttribsReceived");
798 DCHECK(!get_supported_gpu_memory_buffer_attribs_requests_.empty());
799 auto callback = get_supported_gpu_memory_buffer_attribs_requests_.front();
800 get_supported_gpu_memory_buffer_attribs_requests_.pop();
sadrul 2017/04/19 21:45:46 With the change suggested above, this would need t
varad 2017/04/21 13:03:59 Done.
801 callback.Run(supported_attribs);
802 }
803
783 void GpuProcessHost::OnProcessLaunched() { 804 void GpuProcessHost::OnProcessLaunched() {
784 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", 805 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime",
785 base::TimeTicks::Now() - init_start_time_); 806 base::TimeTicks::Now() - init_start_time_);
786 } 807 }
787 808
788 void GpuProcessHost::OnProcessLaunchFailed(int error_code) { 809 void GpuProcessHost::OnProcessLaunchFailed(int error_code) {
789 // TODO(wfh): do something more useful with this error code. 810 // TODO(wfh): do something more useful with this error code.
790 RecordProcessCrash(); 811 RecordProcessCrash();
791 } 812 }
792 813
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 1074
1054 while (!create_gpu_memory_buffer_requests_.empty()) { 1075 while (!create_gpu_memory_buffer_requests_.empty()) {
1055 auto callback = create_gpu_memory_buffer_requests_.front(); 1076 auto callback = create_gpu_memory_buffer_requests_.front();
1056 create_gpu_memory_buffer_requests_.pop(); 1077 create_gpu_memory_buffer_requests_.pop();
1057 callback.Run(gfx::GpuMemoryBufferHandle(), 1078 callback.Run(gfx::GpuMemoryBufferHandle(),
1058 BufferCreationStatus::GPU_HOST_INVALID); 1079 BufferCreationStatus::GPU_HOST_INVALID);
1059 } 1080 }
1060 1081
1061 if (!send_destroying_video_surface_done_cb_.is_null()) 1082 if (!send_destroying_video_surface_done_cb_.is_null())
1062 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run(); 1083 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
1063 } 1084 }
sadrul 2017/04/19 21:45:46 Should you run all the callbacks here too?
varad 2017/04/21 13:03:59 Done.
1064 1085
1065 void GpuProcessHost::BlockLiveOffscreenContexts() { 1086 void GpuProcessHost::BlockLiveOffscreenContexts() {
1066 for (std::multiset<GURL>::iterator iter = 1087 for (std::multiset<GURL>::iterator iter =
1067 urls_with_live_offscreen_contexts_.begin(); 1088 urls_with_live_offscreen_contexts_.begin();
1068 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1089 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1069 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1090 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1070 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1091 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1071 } 1092 }
1072 } 1093 }
1073 1094
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 if (!cache.get()) 1202 if (!cache.get())
1182 return; 1203 return;
1183 1204
1184 cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader, 1205 cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader,
1185 weak_ptr_factory_.GetWeakPtr())); 1206 weak_ptr_factory_.GetWeakPtr()));
1186 1207
1187 client_id_to_shader_cache_[client_id] = cache; 1208 client_id_to_shader_cache_[client_id] = cache;
1188 } 1209 }
1189 1210
1190 } // namespace content 1211 } // 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