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

Side by Side Diff: ui/gl/gl_implementation_android.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_implementation.h ('k') | ui/gl/gl_implementation_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 (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 #include "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/native_library.h" 9 #include "base/native_library.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } // namespace 45 } // namespace
46 46
47 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { 47 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
48 impls->push_back(kGLImplementationEGLGLES2); 48 impls->push_back(kGLImplementationEGLGLES2);
49 } 49 }
50 50
51 bool InitializeStaticGLBindings(GLImplementation implementation) { 51 bool InitializeStaticGLBindings(GLImplementation implementation) {
52 // Prevent reinitialization with a different implementation. Once the gpu 52 // Prevent reinitialization with a different implementation. Once the gpu
53 // unit tests have initialized with kGLImplementationMock, we don't want to 53 // unit tests have initialized with kGLImplementationMock, we don't want to
54 // later switch to another GL implementation. 54 // later switch to another GL implementation.
55 if (GetGLImplementation() != kGLImplementationNone) 55 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
56 return true;
57 56
58 switch (implementation) { 57 switch (implementation) {
59 case kGLImplementationEGLGLES2: { 58 case kGLImplementationEGLGLES2: {
60 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); 59 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so");
61 if (!gles_library) 60 if (!gles_library)
62 return false; 61 return false;
63 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); 62 base::NativeLibrary egl_library = LoadLibrary("libEGL.so");
64 if (!egl_library) { 63 if (!egl_library) {
65 base::UnloadNativeLibrary(gles_library); 64 base::UnloadNativeLibrary(gles_library);
66 return false; 65 return false;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 switch (GetGLImplementation()) { 143 switch (GetGLImplementation()) {
145 case kGLImplementationEGLGLES2: 144 case kGLImplementationEGLGLES2:
146 return GetGLWindowSystemBindingInfoEGL(info); 145 return GetGLWindowSystemBindingInfoEGL(info);
147 default: 146 default:
148 return false; 147 return false;
149 } 148 }
150 return false; 149 return false;
151 } 150 }
152 151
153 } // namespace gfx 152 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_implementation.h ('k') | ui/gl/gl_implementation_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698