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

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

Issue 7890046: Command to mark surface inactive, so gpu process can release resources. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: first cut of IPC version Created 9 years, 2 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/common/gpu/image_transport_surface_linux.cc
diff --git a/content/common/gpu/image_transport_surface_linux.cc b/content/common/gpu/image_transport_surface_linux.cc
index 079294f2bcdcc833edb527e8a9d3e92dd1985673..c9419dcbeb0fc0d817eb7d36e0de808cc6796515 100644
--- a/content/common/gpu/image_transport_surface_linux.cc
+++ b/content/common/gpu/image_transport_surface_linux.cc
@@ -76,6 +76,7 @@ class EGLImageTransportSurface : public ImageTransportSurface,
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
+ virtual void OnSetSurfaceVisible(bool visible) OVERRIDE;
private:
virtual ~EGLImageTransportSurface() OVERRIDE;
@@ -308,6 +309,15 @@ void EGLImageTransportSurface::OnResize(gfx::Size size) {
helper_->SetScheduled(false);
}
+void EGLImageTransportSurface::OnSetSurfaceVisible(bool visible) {
+ if (!visible && back_surface_.get() && front_surface_.get()) {
+ ReleaseSurface(&back_surface_);
+ } else if (visible && !back_surface_.get() && front_surface_.get()) {
+ // Leverage the OnResize hook because it does exactly what we want
+ OnResize(front_surface_->size());
+ }
+}
+
bool EGLImageTransportSurface::SwapBuffers() {
front_surface_.swap(back_surface_);
DCHECK_NE(front_surface_.get(), static_cast<EGLAcceleratedSurface*>(NULL));

Powered by Google App Engine
This is Rietveld 408576698