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

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: 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_ozone.cc ('k') | ui/gl/gl_implementation_x11.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 <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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 return GetGLWindowSystemBindingInfoWGL(info); 374 return GetGLWindowSystemBindingInfoWGL(info);
376 case kGLImplementationEGLGLES2: 375 case kGLImplementationEGLGLES2:
377 return GetGLWindowSystemBindingInfoEGL(info); 376 return GetGLWindowSystemBindingInfoEGL(info);
378 default: 377 default:
379 return false; 378 return false;
380 } 379 }
381 return false; 380 return false;
382 } 381 }
383 382
384 } // namespace gfx 383 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_implementation_ozone.cc ('k') | ui/gl/gl_implementation_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698