| OLD | NEW |
| 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 Loading... |
| 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 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 115 if (GetGLImplementation() != kGLImplementationNone) |
| 116 return true; |
| 116 | 117 |
| 117 // Allow the main thread or another to initialize these bindings | 118 // Allow the main thread or another to initialize these bindings |
| 118 // after instituting restrictions on I/O. Going forward they will | 119 // after instituting restrictions on I/O. Going forward they will |
| 119 // likely be used in the browser process on most platforms. The | 120 // likely be used in the browser process on most platforms. The |
| 120 // one-time initialization cost is small, between 2 and 5 ms. | 121 // one-time initialization cost is small, between 2 and 5 ms. |
| 121 base::ThreadRestrictions::ScopedAllowIO allow_io; | 122 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 122 | 123 |
| 123 switch (implementation) { | 124 switch (implementation) { |
| 124 case kGLImplementationOSMesaGL: { | 125 case kGLImplementationOSMesaGL: { |
| 125 base::FilePath module_path; | 126 base::FilePath module_path; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 return GetGLWindowSystemBindingInfoWGL(info); | 375 return GetGLWindowSystemBindingInfoWGL(info); |
| 375 case kGLImplementationEGLGLES2: | 376 case kGLImplementationEGLGLES2: |
| 376 return GetGLWindowSystemBindingInfoEGL(info); | 377 return GetGLWindowSystemBindingInfoEGL(info); |
| 377 default: | 378 default: |
| 378 return false; | 379 return false; |
| 379 } | 380 } |
| 380 return false; | 381 return false; |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // namespace gfx | 384 } // namespace gfx |
| OLD | NEW |