OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/image_transport_surface_fbo_mac.h" | 5 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
6 | 6 |
7 #include "content/common/gpu/gpu_messages.h" | 7 #include "content/common/gpu/gpu_messages.h" |
8 #include "ui/gfx/native_widget_types.h" | 8 #include "ui/gfx/native_widget_types.h" |
9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
10 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 bool g_allow_os_mesa = false; | 36 bool g_allow_os_mesa = false; |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 // static | 40 // static |
41 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( | 41 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( |
42 GpuChannelManager* manager, | 42 GpuChannelManager* manager, |
43 GpuCommandBufferStub* stub, | 43 GpuCommandBufferStub* stub, |
44 const gfx::GLSurfaceHandle& surface_handle) { | 44 const gfx::GLSurfaceHandle& surface_handle) { |
45 DCHECK(surface_handle.transport_type == gfx::NATIVE_DIRECT || | 45 DCHECK(surface_handle.transport_type == gfx::NATIVE_DIRECT || |
46 surface_handle.transport_type == gfx::NATIVE_TRANSPORT); | 46 surface_handle.transport_type == gfx::NULL_TRANSPORT); |
47 | 47 |
48 switch (gfx::GetGLImplementation()) { | 48 switch (gfx::GetGLImplementation()) { |
49 case gfx::kGLImplementationDesktopGL: | 49 case gfx::kGLImplementationDesktopGL: |
50 case gfx::kGLImplementationAppleGL: | 50 case gfx::kGLImplementationAppleGL: |
51 return scoped_refptr<gfx::GLSurface>(new ImageTransportSurfaceFBO( | 51 return scoped_refptr<gfx::GLSurface>(new ImageTransportSurfaceFBO( |
52 manager, stub, surface_handle.handle)); | 52 manager, stub, surface_handle.handle)); |
53 default: | 53 default: |
54 // Content shell in DRT mode spins up a gpu process which needs an | 54 // Content shell in DRT mode spins up a gpu process which needs an |
55 // image transport surface, but that surface isn't used to read pixel | 55 // image transport surface, but that surface isn't used to read pixel |
56 // baselines. So this is mostly a dummy surface. | 56 // baselines. So this is mostly a dummy surface. |
57 if (!g_allow_os_mesa) { | 57 if (!g_allow_os_mesa) { |
58 NOTREACHED(); | 58 NOTREACHED(); |
59 return scoped_refptr<gfx::GLSurface>(); | 59 return scoped_refptr<gfx::GLSurface>(); |
60 } | 60 } |
61 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); | 61 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); |
62 if (!surface.get() || !surface->Initialize()) | 62 if (!surface.get() || !surface->Initialize()) |
63 return surface; | 63 return surface; |
64 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 64 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
65 manager, stub, surface.get())); | 65 manager, stub, surface.get())); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 // static | 69 // static |
70 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 70 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
71 g_allow_os_mesa = allow; | 71 g_allow_os_mesa = allow; |
72 } | 72 } |
73 | 73 |
74 } // namespace content | 74 } // namespace content |
OLD | NEW |