| 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 e7f304d33958ad47a87a200c335a879744e6958c..a5ce331e6c4d6e223875898f5130a3857041aa75 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();
|
| @@ -245,6 +248,20 @@ void EGLImageTransportSurface::OnResize(gfx::Size size) {
|
| helper_->SetScheduled(false);
|
| }
|
|
|
| +void EGLImageTransportSurface::OnSurfaceVisible(bool visible) {
|
| + if (!visible && back_surface_.get() && front_surface_.get()) {
|
| + printf("[ - ] Releasing a Surface!\n\n");
|
| + ReleaseSurface(&back_surface_);
|
| + } else if (visible && !back_surface_.get() && front_surface_.get()) {
|
| + printf("[ + ] Recreating a Surface!\n\n");
|
| + OnResize(front_surface_->size());
|
| + } else {
|
| + printf("[ . ] Not touching the surface. visible:%s!\n\n",
|
| + visible ? "true" : "false");
|
| + }
|
| + fflush(stdout);
|
| +}
|
| +
|
| bool EGLImageTransportSurface::SwapBuffers() {
|
| front_surface_.swap(back_surface_);
|
| DCHECK_NE(front_surface_.get(), static_cast<AcceleratedSurface*>(NULL));
|
| @@ -387,6 +404,10 @@ void GLXImageTransportSurface::OnResize(gfx::Size size) {
|
| helper_->SetScheduled(false);
|
| }
|
|
|
| +void GLXImageTransportSurface::OnSurfaceVisible(bool visible) {
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| bool GLXImageTransportSurface::SwapBuffers() {
|
| gfx::NativeViewGLSurfaceGLX::SwapBuffers();
|
| glFlush();
|
| @@ -490,6 +511,10 @@ void OSMesaImageTransportSurface::OnResize(gfx::Size size) {
|
| helper_->SetScheduled(false);
|
| }
|
|
|
| +void OSMesaImageTransportSurface::OnSurfaceVisible(bool visible) {
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| void OSMesaImageTransportSurface::OnNewSurfaceACK(
|
| uint64 surface_id, TransportDIB::Handle surface_handle) {
|
| shared_id_ = surface_id;
|
| @@ -596,6 +621,9 @@ bool ImageTransportHelper::Initialize() {
|
| decoder->SetResizeCallback(
|
| NewCallback(this, &ImageTransportHelper::Resize));
|
|
|
| + decoder->SetSurfaceVisibleCallback(
|
| + NewCallback(this, &ImageTransportHelper::SurfaceVisible));
|
| +
|
| return true;
|
| }
|
|
|
| @@ -659,6 +687,10 @@ void ImageTransportHelper::Resize(gfx::Size size) {
|
| surface_->OnResize(size);
|
| }
|
|
|
| +void ImageTransportHelper::SurfaceVisible(bool visible) {
|
| + surface_->OnSurfaceVisible(visible);
|
| +}
|
| +
|
| bool ImageTransportHelper::MakeCurrent() {
|
| gpu::gles2::GLES2Decoder* decoder = Decoder();
|
| if (!decoder)
|
|
|