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

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

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_switches.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This include must be here so that the includes provided transitively 5 // This include must be here so that the includes provided transitively
6 // by gl_surface_egl.h don't make it impossible to compile this code. 6 // by gl_surface_egl.h don't make it impossible to compile this code.
7 #include "third_party/mesa/src/include/GL/osmesa.h" 7 #include "third_party/mesa/src/include/GL/osmesa.h"
8 8
9 #include "ui/gl/gl_surface_egl.h" 9 #include "ui/gl/gl_surface_egl.h"
10 10
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 777
778 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless(gfx::AcceleratedWidget window) 778 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless(gfx::AcceleratedWidget window)
779 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)) { 779 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)) {
780 DCHECK(window); 780 DCHECK(window);
781 } 781 }
782 782
783 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } 783 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); }
784 784
785 // static 785 // static
786 bool GLSurface::InitializeOneOffInternal() { 786 bool GLSurface::InitializeOneOffInternal() {
787 if (GetGLImplementation() == kGLImplementationOSMesaGL) { 787 switch (GetGLImplementation()) {
788 return true; 788 case kGLImplementationEGLGLES2:
789 } 789 if (!GLSurfaceEGL::InitializeOneOff()) {
790 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); 790 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
791 791 return false;
792 if (!GLSurfaceEGL::InitializeOneOff()) { 792 }
793 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; 793 default:
794 return false; 794 break;
795 } 795 }
796 return true; 796 return true;
797 } 797 }
798 798
799 // static 799 // static
800 scoped_refptr<GLSurface> 800 scoped_refptr<GLSurface>
801 GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window) { 801 GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window) {
802 802
803 if (GetGLImplementation() == kGLImplementationOSMesaGL) { 803 if (GetGLImplementation() == kGLImplementationOSMesaGL) {
804 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless(window)); 804 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless(window));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 852 }
853 default: 853 default:
854 NOTREACHED(); 854 NOTREACHED();
855 return NULL; 855 return NULL;
856 } 856 }
857 } 857 }
858 858
859 #endif 859 #endif
860 860
861 } // namespace gfx 861 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698