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

Side by Side Diff: ui/gl/init/gl_factory_ozone.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/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_context_egl.h" 10 #include "ui/gl/gl_context_egl.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 switch (GetGLImplementation()) { 73 switch (GetGLImplementation()) {
74 case kGLImplementationEGLGLES2: 74 case kGLImplementationEGLGLES2:
75 return GetGLWindowSystemBindingInfoEGL(info); 75 return GetGLWindowSystemBindingInfoEGL(info);
76 default: 76 default:
77 return false; 77 return false;
78 } 78 }
79 } 79 }
80 80
81 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, 81 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
82 GLSurface* compatible_surface, 82 GLSurface* compatible_surface,
83 GpuPreference gpu_preference) { 83 const GLContextAttribs& attribs) {
84 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); 84 TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
85 85
86 if (HasGLOzone()) { 86 if (HasGLOzone()) {
87 return GetGLOzone()->CreateGLContext(share_group, compatible_surface, 87 return GetGLOzone()->CreateGLContext(share_group, compatible_surface,
88 gpu_preference); 88 attribs);
89 } 89 }
90 90
91 switch (GetGLImplementation()) { 91 switch (GetGLImplementation()) {
92 case kGLImplementationMockGL: 92 case kGLImplementationMockGL:
93 return scoped_refptr<GLContext>(new GLContextStub(share_group)); 93 return scoped_refptr<GLContext>(new GLContextStub(share_group));
94 case kGLImplementationOSMesaGL: 94 case kGLImplementationOSMesaGL:
95 return InitializeGLContext(new GLContextOSMesa(share_group), 95 return InitializeGLContext(new GLContextOSMesa(share_group),
96 compatible_surface, gpu_preference); 96 compatible_surface, attribs);
97 case kGLImplementationEGLGLES2: 97 case kGLImplementationEGLGLES2:
98 return InitializeGLContext(new GLContextEGL(share_group), 98 return InitializeGLContext(new GLContextEGL(share_group),
99 compatible_surface, gpu_preference); 99 compatible_surface, attribs);
100 default: 100 default:
101 NOTREACHED(); 101 NOTREACHED();
102 } 102 }
103 return nullptr; 103 return nullptr;
104 } 104 }
105 105
106 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { 106 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
107 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); 107 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
108 108
109 if (HasGLOzone()) 109 if (HasGLOzone())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return CreateDefaultOffscreenGLSurface(size); 141 return CreateDefaultOffscreenGLSurface(size);
142 142
143 // TODO(kylechar): This is deprecated and can be removed once all Ozone 143 // TODO(kylechar): This is deprecated and can be removed once all Ozone
144 // platforms use GLOzone instead. 144 // platforms use GLOzone instead.
145 return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface( 145 return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface(
146 GetGLImplementation(), size); 146 GetGLImplementation(), size);
147 } 147 }
148 148
149 } // namespace init 149 } // namespace init
150 } // namespace gl 150 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698