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

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

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: address piman's comments 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/macros.h" 8 #include "base/macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 impls.push_back(kGLImplementationOSMesaGL); 63 impls.push_back(kGLImplementationOSMesaGL);
64 return impls; 64 return impls;
65 } 65 }
66 66
67 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { 67 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
68 return false; 68 return false;
69 } 69 }
70 70
71 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, 71 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
72 GLSurface* compatible_surface, 72 GLSurface* compatible_surface,
73 GpuPreference gpu_preference) { 73 const GLContextAttribs& attribs) {
74 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); 74 TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
75 switch (GetGLImplementation()) { 75 switch (GetGLImplementation()) {
76 case kGLImplementationDesktopGL: 76 case kGLImplementationDesktopGL:
77 case kGLImplementationDesktopGLCoreProfile: 77 case kGLImplementationDesktopGLCoreProfile:
78 case kGLImplementationAppleGL: 78 case kGLImplementationAppleGL:
79 // Note that with virtualization we might still be able to make current 79 // Note that with virtualization we might still be able to make current
80 // a different onscreen surface with this context later. But we should 80 // a different onscreen surface with this context later. But we should
81 // always be creating the context with an offscreen surface first. 81 // always be creating the context with an offscreen surface first.
82 DCHECK(compatible_surface->IsOffscreen()); 82 DCHECK(compatible_surface->IsOffscreen());
83 return InitializeGLContext(new GLContextCGL(share_group), 83 return InitializeGLContext(new GLContextCGL(share_group),
84 compatible_surface, gpu_preference); 84 compatible_surface, attribs);
85 case kGLImplementationOSMesaGL: 85 case kGLImplementationOSMesaGL:
86 return InitializeGLContext(new GLContextOSMesa(share_group), 86 return InitializeGLContext(new GLContextOSMesa(share_group),
87 compatible_surface, gpu_preference); 87 compatible_surface, attribs);
88 case kGLImplementationMockGL: 88 case kGLImplementationMockGL:
89 return new GLContextStub(share_group); 89 return new GLContextStub(share_group);
90 default: 90 default:
91 NOTREACHED(); 91 NOTREACHED();
92 return nullptr; 92 return nullptr;
93 } 93 }
94 } 94 }
95 95
96 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { 96 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
97 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); 97 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
(...skipping 28 matching lines...) Expand all
126 case kGLImplementationMockGL: 126 case kGLImplementationMockGL:
127 return new GLSurfaceStub; 127 return new GLSurfaceStub;
128 default: 128 default:
129 NOTREACHED(); 129 NOTREACHED();
130 return nullptr; 130 return nullptr;
131 } 131 }
132 } 132 }
133 133
134 } // namespace init 134 } // namespace init
135 } // namespace gl 135 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698