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

Side by Side Diff: ui/gl/gl_surface_android.cc

Issue 2024953002: Move GL one-off initialization code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_x11
Patch Set: Delete GLInitializer class. Created 4 years, 6 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/gl_surface.cc ('k') | ui/gl/gl_surface_mac.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 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 "ui/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "third_party/khronos/EGL/egl.h" 9 #include "third_party/khronos/EGL/egl.h"
10 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/gl/gl_implementation.h" 11 #include "ui/gl/gl_implementation.h"
12 #include "ui/gl/gl_surface_egl.h" 12 #include "ui/gl/gl_surface_egl.h"
13 #include "ui/gl/gl_surface_osmesa.h" 13 #include "ui/gl/gl_surface_osmesa.h"
14 #include "ui/gl/gl_surface_stub.h" 14 #include "ui/gl/gl_surface_stub.h"
15 15
16 namespace gl { 16 namespace gl {
17 17
18 // static 18 // static
19 bool GLSurface::InitializeOneOffInternal() {
20 switch (GetGLImplementation()) {
21 case kGLImplementationEGLGLES2:
22 if (!GLSurfaceEGL::InitializeOneOff()) {
23 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
24 return false;
25 }
26 default:
27 break;
28 }
29 return true;
30 }
31
32 // static
33 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( 19 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
34 gfx::AcceleratedWidget window) { 20 gfx::AcceleratedWidget window) {
35 CHECK_NE(kGLImplementationNone, GetGLImplementation()); 21 CHECK_NE(kGLImplementationNone, GetGLImplementation());
36 if (GetGLImplementation() == kGLImplementationOSMesaGL) { 22 if (GetGLImplementation() == kGLImplementationOSMesaGL) {
37 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); 23 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless());
38 if (!surface->Initialize()) 24 if (!surface->Initialize())
39 return NULL; 25 return NULL;
40 return surface; 26 return surface;
41 } 27 }
42 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); 28 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 NOTREACHED(); 70 NOTREACHED();
85 return NULL; 71 return NULL;
86 } 72 }
87 } 73 }
88 74
89 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 75 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
90 return EGL_DEFAULT_DISPLAY; 76 return EGL_DEFAULT_DISPLAY;
91 } 77 }
92 78
93 } // namespace gl 79 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698