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 "gpu/ipc/service/image_transport_surface.h" | 5 #include "gpu/ipc/service/image_transport_surface.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "gpu/ipc/service/image_transport_surface_overlay_mac.h" | 8 #include "gpu/ipc/service/image_transport_surface_overlay_mac.h" |
9 #include "gpu/ipc/service/pass_through_image_transport_surface.h" | 9 #include "gpu/ipc/service/pass_through_image_transport_surface.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 gl::GLSurfaceFormat format) { | 48 gl::GLSurfaceFormat format) { |
49 DCHECK_NE(surface_handle, kNullSurfaceHandle); | 49 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
50 | 50 |
51 switch (gl::GetGLImplementation()) { | 51 switch (gl::GetGLImplementation()) { |
52 case gl::kGLImplementationDesktopGL: | 52 case gl::kGLImplementationDesktopGL: |
53 case gl::kGLImplementationDesktopGLCoreProfile: | 53 case gl::kGLImplementationDesktopGLCoreProfile: |
54 case gl::kGLImplementationAppleGL: | 54 case gl::kGLImplementationAppleGL: |
55 return make_scoped_refptr<gl::GLSurface>( | 55 return make_scoped_refptr<gl::GLSurface>( |
56 new ImageTransportSurfaceOverlayMac(delegate)); | 56 new ImageTransportSurfaceOverlayMac(delegate)); |
57 case gl::kGLImplementationMockGL: | 57 case gl::kGLImplementationMockGL: |
| 58 case gl::kGLImplementationStubGL: |
58 return make_scoped_refptr<gl::GLSurface>(new gl::GLSurfaceStub); | 59 return make_scoped_refptr<gl::GLSurface>(new gl::GLSurfaceStub); |
59 default: | 60 default: |
60 // Content shell in DRT mode spins up a gpu process which needs an | 61 // Content shell in DRT mode spins up a gpu process which needs an |
61 // image transport surface, but that surface isn't used to read pixel | 62 // image transport surface, but that surface isn't used to read pixel |
62 // baselines. So this is mostly a dummy surface. | 63 // baselines. So this is mostly a dummy surface. |
63 if (!g_allow_os_mesa) { | 64 if (!g_allow_os_mesa) { |
64 NOTREACHED(); | 65 NOTREACHED(); |
65 return nullptr; | 66 return nullptr; |
66 } | 67 } |
67 scoped_refptr<gl::GLSurface> surface(new DRTSurfaceOSMesa()); | 68 scoped_refptr<gl::GLSurface> surface(new DRTSurfaceOSMesa()); |
68 if (!surface.get() || !surface->Initialize(format)) | 69 if (!surface.get() || !surface->Initialize(format)) |
69 return surface; | 70 return surface; |
70 return make_scoped_refptr<gl::GLSurface>( | 71 return make_scoped_refptr<gl::GLSurface>( |
71 new PassThroughImageTransportSurface(delegate, surface.get())); | 72 new PassThroughImageTransportSurface(delegate, surface.get())); |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
75 // static | 76 // static |
76 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 77 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
77 g_allow_os_mesa = allow; | 78 g_allow_os_mesa = allow; |
78 } | 79 } |
79 | 80 |
80 } // namespace gpu | 81 } // namespace gpu |
OLD | NEW |