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

Unified Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 712343003: Infrastructure for temportarily relinquishing GPU resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean-up based on feedback from spang and jbauman Created 6 years, 1 month 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_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());
}

Powered by Google App Engine
This is Rietveld 408576698