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

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: Flush only on hide 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 33891606bbf1c5bb0d10d933fbb781e4be2dcc8c..034ff7fe8ee5a69d0d89e4b6c8125a93d63fbaa6 100644
--- a/content/common/gpu/image_transport_surface_linux.cc
+++ b/content/common/gpu/image_transport_surface_linux.cc
@@ -56,6 +56,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 OnSurfaceVisible(bool visible) OVERRIDE;
private:
virtual ~EGLImageTransportSurface() OVERRIDE;
@@ -94,6 +95,7 @@ class GLXImageTransportSurface : public ImageTransportSurface,
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
+ virtual void OnSurfaceVisible(bool visible) OVERRIDE;
private:
virtual ~GLXImageTransportSurface();
@@ -140,6 +142,7 @@ class OSMesaImageTransportSurface : public ImageTransportSurface,
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
+ virtual void OnSurfaceVisible(bool visible) OVERRIDE;
private:
virtual ~OSMesaImageTransportSurface();
@@ -246,6 +249,15 @@ void EGLImageTransportSurface::OnResize(gfx::Size size) {
helper_->SetScheduled(false);
}
+void EGLImageTransportSurface::OnSurfaceVisible(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<AcceleratedSurface*>(NULL));
@@ -389,6 +401,10 @@ void GLXImageTransportSurface::OnResize(gfx::Size size) {
helper_->SetScheduled(false);
}
+void GLXImageTransportSurface::OnSurfaceVisible(bool visible) {
+ NOTREACHED();
jonathan.backer 2011/10/07 15:48:37 Probably will be reached? You'll need to add this
+}
+
bool GLXImageTransportSurface::SwapBuffers() {
gfx::NativeViewGLSurfaceGLX::SwapBuffers();
glFlush();
@@ -493,6 +509,10 @@ void OSMesaImageTransportSurface::OnResize(gfx::Size size) {
helper_->SetScheduled(false);
}
+void OSMesaImageTransportSurface::OnSurfaceVisible(bool visible) {
+ NOTREACHED();
+}
+
void OSMesaImageTransportSurface::OnNewSurfaceACK(
uint64 surface_id, TransportDIB::Handle surface_handle) {
shared_id_ = surface_id;

Powered by Google App Engine
This is Rietveld 408576698