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

Side by Side Diff: ui/gl/gl_implementation_win.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 <vector> 5 #include <vector>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { 105 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
106 impls->push_back(kGLImplementationEGLGLES2); 106 impls->push_back(kGLImplementationEGLGLES2);
107 impls->push_back(kGLImplementationDesktopGL); 107 impls->push_back(kGLImplementationDesktopGL);
108 impls->push_back(kGLImplementationOSMesaGL); 108 impls->push_back(kGLImplementationOSMesaGL);
109 } 109 }
110 110
111 bool InitializeStaticGLBindings(GLImplementation implementation) { 111 bool InitializeStaticGLBindings(GLImplementation implementation) {
112 // Prevent reinitialization with a different implementation. Once the gpu 112 // Prevent reinitialization with a different implementation. Once the gpu
113 // unit tests have initialized with kGLImplementationMock, we don't want to 113 // unit tests have initialized with kGLImplementationMock, we don't want to
114 // later switch to another GL implementation. 114 // later switch to another GL implementation.
115 if (GetGLImplementation() != kGLImplementationNone) 115 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
116 return true;
117 116
118 // Allow the main thread or another to initialize these bindings 117 // Allow the main thread or another to initialize these bindings
119 // after instituting restrictions on I/O. Going forward they will 118 // after instituting restrictions on I/O. Going forward they will
120 // likely be used in the browser process on most platforms. The 119 // likely be used in the browser process on most platforms. The
121 // one-time initialization cost is small, between 2 and 5 ms. 120 // one-time initialization cost is small, between 2 and 5 ms.
122 base::ThreadRestrictions::ScopedAllowIO allow_io; 121 base::ThreadRestrictions::ScopedAllowIO allow_io;
123 122
124 switch (implementation) { 123 switch (implementation) {
125 case kGLImplementationOSMesaGL: { 124 case kGLImplementationOSMesaGL: {
126 base::FilePath module_path; 125 base::FilePath module_path;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return GetGLWindowSystemBindingInfoWGL(info); 375 return GetGLWindowSystemBindingInfoWGL(info);
377 case kGLImplementationEGLGLES2: 376 case kGLImplementationEGLGLES2:
378 return GetGLWindowSystemBindingInfoEGL(info); 377 return GetGLWindowSystemBindingInfoEGL(info);
379 default: 378 default:
380 return false; 379 return false;
381 } 380 }
382 return false; 381 return false;
383 } 382 }
384 383
385 } // namespace gfx 384 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698