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..50760b6e3617af8c666b22e782a2a9a4c3131b43 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,22 @@ gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
return default_offscreen_surface_.get(); |
} |
+void GpuChannelManager::OnRelinquishResources() { |
+ if (default_offscreen_surface_.get()) { |
+ default_offscreen_surface_->Destroy(); |
+ default_offscreen_surface_ = NULL; |
+ } |
+#if defined(USE_OZONE) |
+ ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport()-> |
+ RelinquishGpuResources(base::Bind( |
+ &GpuChannelManager::OnResourcesReliuquished, base::Unretained(this))); |
piman
2014/11/20 21:06:43
Is Unretained safe?
If it is, can you document why
GusFernandez
2014/11/20 21:42:48
Used the safer weak_factory_.GetWeakPtr() instead.
|
+#else |
+ OnResourcesReliuquished(); |
piman
2014/11/20 21:06:43
typo: Reliuquished -> Relinquished
GusFernandez
2014/11/20 21:42:48
Done.
|
+#endif |
+} |
+ |
+void GpuChannelManager::OnResourcesReliuquished() { |
+ Send(new GpuHostMsg_ResourcesRelinquished()); |
+} |
+ |
} // namespace content |