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

Side by Side Diff: gpu/ipc/service/image_transport_surface_mac.mm

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop ref to deleted content_tests_gypi_values.content_unittests_ozone_sources Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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.h" 5 #include "gpu/ipc/service/image_transport_surface.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "content/common/gpu/pass_through_image_transport_surface.h" 8 #include "gpu/ipc/service/pass_through_image_transport_surface.h"
9 #include "ui/gfx/native_widget_types.h" 9 #include "ui/gfx/native_widget_types.h"
10 #include "ui/gl/gl_surface_osmesa.h" 10 #include "ui/gl/gl_surface_osmesa.h"
11 11
12 namespace content { 12 namespace gpu {
13 13
14 scoped_refptr<gfx::GLSurface> ImageTransportSurfaceCreateNativeSurface( 14 scoped_refptr<gfx::GLSurface> ImageTransportSurfaceCreateNativeSurface(
15 GpuChannelManager* manager, 15 GpuChannelManager* manager,
16 GpuCommandBufferStub* stub, 16 GpuCommandBufferStub* stub,
17 gpu::SurfaceHandle handle); 17 SurfaceHandle handle);
18 18
19 namespace { 19 namespace {
20 20
21 // A subclass of GLSurfaceOSMesa that doesn't print an error message when 21 // A subclass of GLSurfaceOSMesa that doesn't print an error message when
22 // SwapBuffers() is called. 22 // SwapBuffers() is called.
23 class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa { 23 class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa {
24 public: 24 public:
25 // Size doesn't matter, the surface is resized to the right size later. 25 // Size doesn't matter, the surface is resized to the right size later.
26 DRTSurfaceOSMesa() 26 DRTSurfaceOSMesa()
27 : GLSurfaceOSMesa(gfx::GLSurface::SURFACE_OSMESA_RGBA, gfx::Size(1, 1)) {} 27 : GLSurfaceOSMesa(gfx::GLSurface::SURFACE_OSMESA_RGBA, gfx::Size(1, 1)) {}
(...skipping 11 matching lines...) Expand all
39 } 39 }
40 40
41 bool g_allow_os_mesa = false; 41 bool g_allow_os_mesa = false;
42 42
43 } // namespace 43 } // namespace
44 44
45 // static 45 // static
46 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( 46 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(
47 GpuChannelManager* manager, 47 GpuChannelManager* manager,
48 GpuCommandBufferStub* stub, 48 GpuCommandBufferStub* stub,
49 gpu::SurfaceHandle surface_handle, 49 SurfaceHandle surface_handle,
50 gfx::GLSurface::Format format) { 50 gfx::GLSurface::Format format) {
51 DCHECK_NE(surface_handle, gpu::kNullSurfaceHandle); 51 DCHECK_NE(surface_handle, kNullSurfaceHandle);
52 52
53 switch (gfx::GetGLImplementation()) { 53 switch (gfx::GetGLImplementation()) {
54 case gfx::kGLImplementationDesktopGL: 54 case gfx::kGLImplementationDesktopGL:
55 case gfx::kGLImplementationDesktopGLCoreProfile: 55 case gfx::kGLImplementationDesktopGLCoreProfile:
56 case gfx::kGLImplementationAppleGL: 56 case gfx::kGLImplementationAppleGL:
57 return ImageTransportSurfaceCreateNativeSurface(manager, stub, 57 return ImageTransportSurfaceCreateNativeSurface(manager, stub,
58 surface_handle); 58 surface_handle);
59 default: 59 default:
60 // Content shell in DRT mode spins up a gpu process which needs an 60 // 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 61 // image transport surface, but that surface isn't used to read pixel
62 // baselines. So this is mostly a dummy surface. 62 // baselines. So this is mostly a dummy surface.
63 if (!g_allow_os_mesa) { 63 if (!g_allow_os_mesa) {
64 NOTREACHED(); 64 NOTREACHED();
65 return nullptr; 65 return nullptr;
66 } 66 }
67 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); 67 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa());
68 if (!surface.get() || !surface->Initialize(format)) 68 if (!surface.get() || !surface->Initialize(format))
69 return surface; 69 return surface;
70 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( 70 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface(
71 manager, stub, surface.get())); 71 manager, stub, surface.get()));
72 } 72 }
73 } 73 }
74 74
75 // static 75 // static
76 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { 76 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) {
77 g_allow_os_mesa = allow; 77 g_allow_os_mesa = allow;
78 } 78 }
79 79
80 } // namespace content 80 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/image_transport_surface_linux.cc ('k') | gpu/ipc/service/image_transport_surface_overlay_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698