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

Side by Side Diff: ui/gl/gl_implementation_mac.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: Created 6 years, 11 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
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/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.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 13 matching lines...) Expand all
24 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { 24 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
25 impls->push_back(kGLImplementationDesktopGL); 25 impls->push_back(kGLImplementationDesktopGL);
26 impls->push_back(kGLImplementationAppleGL); 26 impls->push_back(kGLImplementationAppleGL);
27 impls->push_back(kGLImplementationOSMesaGL); 27 impls->push_back(kGLImplementationOSMesaGL);
28 } 28 }
29 29
30 bool InitializeStaticGLBindings(GLImplementation implementation) { 30 bool InitializeStaticGLBindings(GLImplementation implementation) {
31 // Prevent reinitialization with a different implementation. Once the gpu 31 // Prevent reinitialization with a different implementation. Once the gpu
32 // unit tests have initialized with kGLImplementationMock, we don't want to 32 // unit tests have initialized with kGLImplementationMock, we don't want to
33 // later switch to another GL implementation. 33 // later switch to another GL implementation.
34 if (GetGLImplementation() != kGLImplementationNone) 34 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
35 return true;
36 35
37 // Allow the main thread or another to initialize these bindings 36 // Allow the main thread or another to initialize these bindings
38 // after instituting restrictions on I/O. Going forward they will 37 // after instituting restrictions on I/O. Going forward they will
39 // likely be used in the browser process on most platforms. The 38 // likely be used in the browser process on most platforms. The
40 // one-time initialization cost is small, between 2 and 5 ms. 39 // one-time initialization cost is small, between 2 and 5 ms.
41 base::ThreadRestrictions::ScopedAllowIO allow_io; 40 base::ThreadRestrictions::ScopedAllowIO allow_io;
42 41
43 switch (implementation) { 42 switch (implementation) {
44 case kGLImplementationOSMesaGL: { 43 case kGLImplementationOSMesaGL: {
45 // osmesa.so is located in the build directory. This code path is only 44 // osmesa.so is located in the build directory. This code path is only
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 SetGLImplementation(kGLImplementationNone); 147 SetGLImplementation(kGLImplementationNone);
149 148
150 UnloadGLNativeLibraries(); 149 UnloadGLNativeLibraries();
151 } 150 }
152 151
153 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { 152 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
154 return false; 153 return false;
155 } 154 }
156 155
157 } // namespace gfx 156 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698