Index: content/browser/gpu/gpu_process_host_ui_shim.cc |
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc |
index 8c4450628e7885b8275398a0659b4d9867022fd5..e04441e370dcee9521ae4b11f43165b8d8b19b25 100644 |
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc |
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc |
@@ -180,6 +180,24 @@ bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { |
return OnControlMessageReceived(message); |
} |
+void GpuProcessHostUIShim::RelinquishGpuResources( |
+ const base::Closure& callback) { |
+ DCHECK(!callback.is_null()); |
+ // We end up sending two messages to the GPU process. the first is handled by |
+ // GpuChannelManager to release the default_offscreen_surface which |
+ // may hold a pointer to the EGL display which is about to be released. |
+ // The second is sent indirectly by the Ozone platform to release all |
+ // remaining OpenGL and EGL resources. It calls the callback once this is |
+ // completed and it is safe for an external process to access the GPU. |
+ // A default implementation runs the callback immediately. |
+ Send(new GpuMsg_DeleteDefaultOffscreenSurface()); |
+#if defined(USE_OZONE) |
+ ui::OzonePlatform::GetInstance()->RelinquishGpuResources(callback); |
+#else |
+ callback.Run(); |
+#endif |
+} |
+ |
void GpuProcessHostUIShim::SimulateRemoveAllContext() { |
Send(new GpuMsg_Clean()); |
} |