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

Unified Diff: content/common/gpu/gpu_channel_manager.cc

Issue 712343003: Infrastructure for temportarily relinquishing GPU resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes suggested by dcheng 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
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_channel_manager.cc
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc
index a073e20151edce4dc033a6d9e54bf3c0196b214a..02f27f28e4b230c9fb12dec6a99bec4cf3896b3c 100644
--- a/content/common/gpu/gpu_channel_manager.cc
+++ b/content/common/gpu/gpu_channel_manager.cc
@@ -20,6 +20,10 @@
#include "ipc/message_filter.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_share_group.h"
+#if defined(USE_OZONE)
+#include "ui/ozone/public/gpu_platform_support.h"
+#include "ui/ozone/public/ozone_platform.h"
+#endif
namespace content {
@@ -162,6 +166,7 @@ bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) {
OnCreateViewCommandBuffer)
IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer)
IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader)
+ IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -323,4 +328,24 @@ gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() {
return default_offscreen_surface_.get();
}
+void GpuChannelManager::OnRelinquishResources() {
+ if (default_offscreen_surface_.get()) {
+ default_offscreen_surface_->DestroyAndTerminateDisplay();
+ default_offscreen_surface_ = nullptr;
+ }
+#if defined(USE_OZONE)
+ ui::OzonePlatform::GetInstance()
+ ->GetGpuPlatformSupport()
+ ->RelinquishGpuResources(
+ base::Bind(&GpuChannelManager::OnResourcesRelinquished,
+ weak_factory_.GetWeakPtr()));
+#else
+ OnResourcesRelinquished();
+#endif
+}
+
+void GpuChannelManager::OnResourcesRelinquished() {
+ Send(new GpuHostMsg_ResourcesRelinquished());
+}
+
} // namespace content
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698