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

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

Issue 1878103002: Plumb a Browser->GPU surface destruction message for Android VDAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a threadchecker Created 4 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
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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 process_->GetHost()->AddFilter(filter); 600 process_->GetHost()->AddFilter(filter);
601 } 601 }
602 602
603 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 603 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
604 DCHECK(CalledOnValidThread()); 604 DCHECK(CalledOnValidThread());
605 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 605 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
606 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized) 606 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized)
607 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 607 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
608 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, 608 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
609 OnGpuMemoryBufferCreated) 609 OnGpuMemoryBufferCreated)
610 #if defined(OS_ANDROID)
611 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyingVideoSurfaceAck,
612 OnDestroyingVideoSurfaceAck)
613 #endif
610 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, 614 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext,
611 OnDidCreateOffscreenContext) 615 OnDidCreateOffscreenContext)
612 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) 616 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
613 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, 617 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext,
614 OnDidDestroyOffscreenContext) 618 OnDidDestroyOffscreenContext)
615 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 619 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
616 OnGpuMemoryUmaStatsReceived) 620 OnGpuMemoryUmaStatsReceived)
617 #if defined(OS_MACOSX) 621 #if defined(OS_MACOSX)
618 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 622 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
619 OnAcceleratedSurfaceBuffersSwapped(message)) 623 OnAcceleratedSurfaceBuffersSwapped(message))
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 776 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
773 int client_id, 777 int client_id,
774 const gpu::SyncToken& sync_token) { 778 const gpu::SyncToken& sync_token) {
775 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); 779 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer");
776 780
777 DCHECK(CalledOnValidThread()); 781 DCHECK(CalledOnValidThread());
778 782
779 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); 783 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token));
780 } 784 }
781 785
786 #if defined(OS_ANDROID)
787 void GpuProcessHost::SendDestroyingVideoSurface(int surface_id,
788 const base::Closure& done_cb) {
789 TRACE_EVENT0("gpu", "GpuProcessHost::SendDestroyingVideoSurface");
790 DCHECK(send_destroying_video_surface_done_cb_.is_null());
791 DCHECK(!done_cb.is_null());
792 if (Send(new GpuMsg_DestroyingVideoSurface(surface_id))) {
793 send_destroying_video_surface_done_cb_ = done_cb;
794 } else {
795 done_cb.Run();
796 }
797 }
798 #endif
799
782 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { 800 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) {
783 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); 801 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
784 initialized_ = result; 802 initialized_ = result;
785 gpu_info_ = gpu_info; 803 gpu_info_ = gpu_info;
786 804
787 if (!initialized_) 805 if (!initialized_)
788 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); 806 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure();
789 else if (!in_process_) 807 else if (!in_process_)
790 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 808 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
791 } 809 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 843
826 if (create_gpu_memory_buffer_requests_.empty()) 844 if (create_gpu_memory_buffer_requests_.empty())
827 return; 845 return;
828 846
829 CreateGpuMemoryBufferCallback callback = 847 CreateGpuMemoryBufferCallback callback =
830 create_gpu_memory_buffer_requests_.front(); 848 create_gpu_memory_buffer_requests_.front();
831 create_gpu_memory_buffer_requests_.pop(); 849 create_gpu_memory_buffer_requests_.pop();
832 callback.Run(handle); 850 callback.Run(handle);
833 } 851 }
834 852
853 #if defined(OS_ANDROID)
854 void GpuProcessHost::OnDestroyingVideoSurfaceAck(int surface_id) {
855 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyingVideoSurfaceAck");
856 if (!send_destroying_video_surface_done_cb_.is_null())
857 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
858 }
859 #endif
860
835 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { 861 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) {
836 urls_with_live_offscreen_contexts_.insert(url); 862 urls_with_live_offscreen_contexts_.insert(url);
837 } 863 }
838 864
839 void GpuProcessHost::OnDidLoseContext(bool offscreen, 865 void GpuProcessHost::OnDidLoseContext(bool offscreen,
840 gpu::error::ContextLostReason reason, 866 gpu::error::ContextLostReason reason,
841 const GURL& url) { 867 const GURL& url) {
842 // TODO(kbr): would be nice to see the "offscreen" flag too. 868 // TODO(kbr): would be nice to see the "offscreen" flag too.
843 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", 869 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext",
844 "reason", reason, 870 "reason", reason,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 channel_requests_.pop(); 1049 channel_requests_.pop();
1024 request.callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); 1050 request.callback.Run(IPC::ChannelHandle(), gpu::GPUInfo());
1025 } 1051 }
1026 1052
1027 while (!create_gpu_memory_buffer_requests_.empty()) { 1053 while (!create_gpu_memory_buffer_requests_.empty()) {
1028 CreateGpuMemoryBufferCallback callback = 1054 CreateGpuMemoryBufferCallback callback =
1029 create_gpu_memory_buffer_requests_.front(); 1055 create_gpu_memory_buffer_requests_.front();
1030 create_gpu_memory_buffer_requests_.pop(); 1056 create_gpu_memory_buffer_requests_.pop();
1031 callback.Run(gfx::GpuMemoryBufferHandle()); 1057 callback.Run(gfx::GpuMemoryBufferHandle());
1032 } 1058 }
1059
1060 if (!send_destroying_video_surface_done_cb_.is_null())
1061 base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
1033 } 1062 }
1034 1063
1035 void GpuProcessHost::BlockLiveOffscreenContexts() { 1064 void GpuProcessHost::BlockLiveOffscreenContexts() {
1036 for (std::multiset<GURL>::iterator iter = 1065 for (std::multiset<GURL>::iterator iter =
1037 urls_with_live_offscreen_contexts_.begin(); 1066 urls_with_live_offscreen_contexts_.begin();
1038 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1067 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1039 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1068 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1040 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1069 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1041 } 1070 }
1042 } 1071 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1179 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1151 ClientIdToShaderCacheMap::iterator iter = 1180 ClientIdToShaderCacheMap::iterator iter =
1152 client_id_to_shader_cache_.find(client_id); 1181 client_id_to_shader_cache_.find(client_id);
1153 // If the cache doesn't exist then this is an off the record profile. 1182 // If the cache doesn't exist then this is an off the record profile.
1154 if (iter == client_id_to_shader_cache_.end()) 1183 if (iter == client_id_to_shader_cache_.end())
1155 return; 1184 return;
1156 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1185 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1157 } 1186 }
1158 1187
1159 } // namespace content 1188 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/media/android/browser_surface_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698