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

Side by Side Diff: ui/gl/init/gl_factory_x11.cc

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/gl/init/gl_factory.h" 5 #include "ui/gl/init/gl_factory.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "ui/gl/gl_context.h" 8 #include "ui/gl/gl_context.h"
9 #include "ui/gl/gl_context_egl.h" 9 #include "ui/gl/gl_context_egl.h"
10 #include "ui/gl/gl_context_glx.h" 10 #include "ui/gl/gl_context_glx.h"
(...skipping 29 matching lines...) Expand all
40 return GetGLWindowSystemBindingInfoGLX(info); 40 return GetGLWindowSystemBindingInfoGLX(info);
41 case kGLImplementationEGLGLES2: 41 case kGLImplementationEGLGLES2:
42 return GetGLWindowSystemBindingInfoEGL(info); 42 return GetGLWindowSystemBindingInfoEGL(info);
43 default: 43 default:
44 return false; 44 return false;
45 } 45 }
46 } 46 }
47 47
48 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, 48 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
49 GLSurface* compatible_surface, 49 GLSurface* compatible_surface,
50 GpuPreference gpu_preference) { 50 const GLContextAttribs& attribs) {
51 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); 51 TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
52 switch (GetGLImplementation()) { 52 switch (GetGLImplementation()) {
53 case kGLImplementationOSMesaGL: 53 case kGLImplementationOSMesaGL:
54 return InitializeGLContext(new GLContextOSMesa(share_group), 54 return InitializeGLContext(new GLContextOSMesa(share_group),
55 compatible_surface, gpu_preference); 55 compatible_surface, attribs);
56 case kGLImplementationDesktopGL: 56 case kGLImplementationDesktopGL:
57 return InitializeGLContext(new GLContextGLX(share_group), 57 return InitializeGLContext(new GLContextGLX(share_group),
58 compatible_surface, gpu_preference); 58 compatible_surface, attribs);
59 case kGLImplementationEGLGLES2: 59 case kGLImplementationEGLGLES2:
60 return InitializeGLContext(new GLContextEGL(share_group), 60 return InitializeGLContext(new GLContextEGL(share_group),
61 compatible_surface, gpu_preference); 61 compatible_surface, attribs);
62 case kGLImplementationMockGL: 62 case kGLImplementationMockGL:
63 return new GLContextStub(share_group); 63 return new GLContextStub(share_group);
64 default: 64 default:
65 NOTREACHED(); 65 NOTREACHED();
66 return nullptr; 66 return nullptr;
67 } 67 }
68 } 68 }
69 69
70 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { 70 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
71 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); 71 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
(...skipping 26 matching lines...) Expand all
98 case kGLImplementationMockGL: 98 case kGLImplementationMockGL:
99 return new GLSurfaceStub; 99 return new GLSurfaceStub;
100 default: 100 default:
101 NOTREACHED(); 101 NOTREACHED();
102 return nullptr; 102 return nullptr;
103 } 103 }
104 } 104 }
105 105
106 } // namespace init 106 } // namespace init
107 } // namespace gl 107 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698