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

Side by Side Diff: ui/gl/gl_implementation_x11.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_win.cc ('k') | ui/gl/gl_surface.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 #include <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 25 matching lines...) Expand all
36 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { 36 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
37 impls->push_back(kGLImplementationDesktopGL); 37 impls->push_back(kGLImplementationDesktopGL);
38 impls->push_back(kGLImplementationEGLGLES2); 38 impls->push_back(kGLImplementationEGLGLES2);
39 impls->push_back(kGLImplementationOSMesaGL); 39 impls->push_back(kGLImplementationOSMesaGL);
40 } 40 }
41 41
42 bool InitializeStaticGLBindings(GLImplementation implementation) { 42 bool InitializeStaticGLBindings(GLImplementation implementation) {
43 // Prevent reinitialization with a different implementation. Once the gpu 43 // Prevent reinitialization with a different implementation. Once the gpu
44 // unit tests have initialized with kGLImplementationMock, we don't want to 44 // unit tests have initialized with kGLImplementationMock, we don't want to
45 // later switch to another GL implementation. 45 // later switch to another GL implementation.
46 if (GetGLImplementation() != kGLImplementationNone) 46 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
47 return true;
48 47
49 // Allow the main thread or another to initialize these bindings 48 // Allow the main thread or another to initialize these bindings
50 // after instituting restrictions on I/O. Going forward they will 49 // after instituting restrictions on I/O. Going forward they will
51 // likely be used in the browser process on most platforms. The 50 // likely be used in the browser process on most platforms. The
52 // one-time initialization cost is small, between 2 and 5 ms. 51 // one-time initialization cost is small, between 2 and 5 ms.
53 base::ThreadRestrictions::ScopedAllowIO allow_io; 52 base::ThreadRestrictions::ScopedAllowIO allow_io;
54 53
55 switch (implementation) { 54 switch (implementation) {
56 case kGLImplementationOSMesaGL: 55 case kGLImplementationOSMesaGL:
57 return InitializeStaticGLBindingsOSMesaGL(); 56 return InitializeStaticGLBindingsOSMesaGL();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return GetGLWindowSystemBindingInfoGLX(info); 193 return GetGLWindowSystemBindingInfoGLX(info);
195 case kGLImplementationEGLGLES2: 194 case kGLImplementationEGLGLES2:
196 return GetGLWindowSystemBindingInfoEGL(info); 195 return GetGLWindowSystemBindingInfoEGL(info);
197 default: 196 default:
198 return false; 197 return false;
199 } 198 }
200 return false; 199 return false;
201 } 200 }
202 201
203 } // namespace gfx 202 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_implementation_win.cc ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698