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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index f72aaefbade7055e1b0d53aaabb9c08d1a660122..4442da4ee6ad9392b1a9f54255c7bba13b136b31 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -607,6 +607,10 @@ bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
OnGpuMemoryBufferCreated)
+#if defined(OS_ANDROID)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyingVideoSurfaceAck,
+ OnDestroyingVideoSurfaceAck)
+#endif
IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext,
OnDidCreateOffscreenContext)
IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
@@ -779,6 +783,20 @@ void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token));
}
+#if defined(OS_ANDROID)
+void GpuProcessHost::SendDestroyingVideoSurface(int surface_id,
+ const base::Closure& done_cb) {
+ TRACE_EVENT0("gpu", "GpuProcessHost::SendDestroyingVideoSurface");
+ DCHECK(send_destroying_video_surface_done_cb_.is_null());
+ DCHECK(!done_cb.is_null());
+ if (Send(new GpuMsg_DestroyingVideoSurface(surface_id))) {
+ send_destroying_video_surface_done_cb_ = done_cb;
+ } else {
+ done_cb.Run();
+ }
+}
+#endif
+
void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) {
UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
initialized_ = result;
@@ -832,6 +850,14 @@ void GpuProcessHost::OnGpuMemoryBufferCreated(
callback.Run(handle);
}
+#if defined(OS_ANDROID)
+void GpuProcessHost::OnDestroyingVideoSurfaceAck(int surface_id) {
+ TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyingVideoSurfaceAck");
+ if (!send_destroying_video_surface_done_cb_.is_null())
+ base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
+}
+#endif
+
void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) {
urls_with_live_offscreen_contexts_.insert(url);
}
@@ -1030,6 +1056,9 @@ void GpuProcessHost::SendOutstandingReplies() {
create_gpu_memory_buffer_requests_.pop();
callback.Run(gfx::GpuMemoryBufferHandle());
}
+
+ if (!send_destroying_video_surface_done_cb_.is_null())
+ base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
}
void GpuProcessHost::BlockLiveOffscreenContexts() {
« 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