Index: content/common/gpu/image_transport_surface_mac.cc |
diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc |
index 7db1d8cf9140a342e2de18419360a040b93461de..7d2ac9ca422654d2a64cf0f423b176a43b7a4aaf 100644 |
--- a/content/common/gpu/image_transport_surface_mac.cc |
+++ b/content/common/gpu/image_transport_surface_mac.cc |
@@ -8,11 +8,13 @@ |
#include "base/memory/scoped_ptr.h" |
#include "content/common/gpu/gpu_messages.h" |
#include "content/common/gpu/texture_image_transport_surface.h" |
+#include "content/shell/shell_switches.h" |
jochen (gone - plz use gerrit)
2013/02/26 14:12:07
why do you need this?
Nico
2013/02/26 14:26:52
Removed.
|
#include "ui/gfx/native_widget_types.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_context.h" |
#include "ui/gl/gl_implementation.h" |
#include "ui/gl/gl_surface_cgl.h" |
+#include "ui/gl/gl_surface_osmesa.h" |
#include "ui/surface/io_surface_support_mac.h" |
namespace content { |
@@ -410,6 +412,28 @@ void IOSurfaceImageTransportSurface::CreateIOSurface() { |
// The FBO remains bound for this GL context. |
} |
+// A subclass of GLSurfaceOSMesa that doesn't print an error message when |
+// SwapBuffers() is called. |
+class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa { |
+ public: |
+ // Size doesn't matter, the surface is resized to the right size later. |
+ explicit DRTSurfaceOSMesa() |
jochen (gone - plz use gerrit)
2013/02/26 14:12:07
no explicit
Nico
2013/02/26 14:26:52
Done.
|
+ : GLSurfaceOSMesa(GL_RGBA, gfx::Size(1, 1)) {} |
+ |
+ // Implement a subset of GLSurface. |
+ virtual bool SwapBuffers() OVERRIDE; |
+ |
+ private: |
+ ~DRTSurfaceOSMesa() {} |
jochen (gone - plz use gerrit)
2013/02/26 14:12:07
virtual
Nico
2013/02/26 14:26:52
Done.
|
+ DISALLOW_COPY_AND_ASSIGN(DRTSurfaceOSMesa); |
+}; |
+ |
+bool DRTSurfaceOSMesa::SwapBuffers() { |
+ return true; |
+} |
+ |
+bool g_allow_os_mesa = false; |
+ |
} // namespace |
// static |
@@ -436,8 +460,15 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
} |
break; |
default: |
- NOTREACHED(); |
- return NULL; |
+ // Content shell in DRT mode spins up a gpu process which needs an |
+ // image transport surface, but that surface isn't used to read pixel |
+ // baselines. So this is mostly a dummy surface. |
+ if (g_allow_os_mesa) { |
+ surface = new DRTSurfaceOSMesa(); |
jochen (gone - plz use gerrit)
2013/02/26 14:12:07
does it matter that it prints the error message? C
Nico
2013/02/26 14:26:52
Sure it matters, random error log spew is confusin
|
+ } else { |
+ NOTREACHED(); |
+ return NULL; |
+ } |
} |
} |
if (surface->Initialize()) |
@@ -446,4 +477,9 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
return NULL; |
} |
+// static |
+void ImageTransportSurface::SetAllowOSMesa(bool allow) { |
+ g_allow_os_mesa = allow; |
+} |
+ |
} // namespace content |