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

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

Issue 2189233003: Move last of platform dependent init from //ui/gl to //ui/gl/init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix return values. Created 4 years, 4 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
« no previous file with comments | « ui/gl/init/gl_factory_win.cc ('k') | ui/gl/test/gl_image_test_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "ui/gl/gl_context_osmesa.h" 11 #include "ui/gl/gl_context_osmesa.h"
12 #include "ui/gl/gl_context_stub.h" 12 #include "ui/gl/gl_context_stub.h"
13 #include "ui/gl/gl_egl_api_implementation.h"
14 #include "ui/gl/gl_glx_api_implementation.h"
13 #include "ui/gl/gl_implementation.h" 15 #include "ui/gl/gl_implementation.h"
14 #include "ui/gl/gl_share_group.h" 16 #include "ui/gl/gl_share_group.h"
15 #include "ui/gl/gl_surface.h" 17 #include "ui/gl/gl_surface.h"
16 #include "ui/gl/gl_surface_egl.h" 18 #include "ui/gl/gl_surface_egl.h"
17 #include "ui/gl/gl_surface_egl_x11.h" 19 #include "ui/gl/gl_surface_egl_x11.h"
18 #include "ui/gl/gl_surface_glx.h" 20 #include "ui/gl/gl_surface_glx.h"
19 #include "ui/gl/gl_surface_osmesa.h" 21 #include "ui/gl/gl_surface_osmesa.h"
20 #include "ui/gl/gl_surface_osmesa_x11.h" 22 #include "ui/gl/gl_surface_osmesa_x11.h"
21 #include "ui/gl/gl_surface_stub.h" 23 #include "ui/gl/gl_surface_stub.h"
22 24
23 namespace gl { 25 namespace gl {
24 namespace init { 26 namespace init {
25 27
28 std::vector<GLImplementation> GetAllowedGLImplementations() {
29 std::vector<GLImplementation> impls;
30 impls.push_back(kGLImplementationDesktopGL);
31 impls.push_back(kGLImplementationEGLGLES2);
32 impls.push_back(kGLImplementationOSMesaGL);
33 return impls;
34 }
35
36 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
37 switch (GetGLImplementation()) {
38 case kGLImplementationDesktopGL:
39 return GetGLWindowSystemBindingInfoGLX(info);
40 case kGLImplementationEGLGLES2:
41 return GetGLWindowSystemBindingInfoEGL(info);
42 default:
43 return false;
44 }
45 }
46
26 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, 47 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
27 GLSurface* compatible_surface, 48 GLSurface* compatible_surface,
28 GpuPreference gpu_preference) { 49 GpuPreference gpu_preference) {
29 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); 50 TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
30 switch (GetGLImplementation()) { 51 switch (GetGLImplementation()) {
31 case kGLImplementationOSMesaGL: 52 case kGLImplementationOSMesaGL:
32 return InitializeGLContext(new GLContextOSMesa(share_group), 53 return InitializeGLContext(new GLContextOSMesa(share_group),
33 compatible_surface, gpu_preference); 54 compatible_surface, gpu_preference);
34 case kGLImplementationDesktopGL: 55 case kGLImplementationDesktopGL:
35 return InitializeGLContext(new GLContextGLX(share_group), 56 return InitializeGLContext(new GLContextGLX(share_group),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 case kGLImplementationMockGL: 97 case kGLImplementationMockGL:
77 return new GLSurfaceStub; 98 return new GLSurfaceStub;
78 default: 99 default:
79 NOTREACHED(); 100 NOTREACHED();
80 return nullptr; 101 return nullptr;
81 } 102 }
82 } 103 }
83 104
84 } // namespace init 105 } // namespace init
85 } // namespace gl 106 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory_win.cc ('k') | ui/gl/test/gl_image_test_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698