| 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/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  Loading... | 
|   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   DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |   46   if (GetGLImplementation() != kGLImplementationNone) | 
 |   47     return true; | 
|   47  |   48  | 
|   48   // Allow the main thread or another to initialize these bindings |   49   // Allow the main thread or another to initialize these bindings | 
|   49   // after instituting restrictions on I/O. Going forward they will |   50   // after instituting restrictions on I/O. Going forward they will | 
|   50   // likely be used in the browser process on most platforms. The |   51   // likely be used in the browser process on most platforms. The | 
|   51   // one-time initialization cost is small, between 2 and 5 ms. |   52   // one-time initialization cost is small, between 2 and 5 ms. | 
|   52   base::ThreadRestrictions::ScopedAllowIO allow_io; |   53   base::ThreadRestrictions::ScopedAllowIO allow_io; | 
|   53  |   54  | 
|   54   switch (implementation) { |   55   switch (implementation) { | 
|   55     case kGLImplementationOSMesaGL: |   56     case kGLImplementationOSMesaGL: | 
|   56       return InitializeStaticGLBindingsOSMesaGL(); |   57       return InitializeStaticGLBindingsOSMesaGL(); | 
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  193       return GetGLWindowSystemBindingInfoGLX(info); |  194       return GetGLWindowSystemBindingInfoGLX(info); | 
|  194     case kGLImplementationEGLGLES2: |  195     case kGLImplementationEGLGLES2: | 
|  195       return GetGLWindowSystemBindingInfoEGL(info); |  196       return GetGLWindowSystemBindingInfoEGL(info); | 
|  196     default: |  197     default: | 
|  197       return false; |  198       return false; | 
|  198   } |  199   } | 
|  199   return false; |  200   return false; | 
|  200 } |  201 } | 
|  201  |  202  | 
|  202 }  // namespace gfx |  203 }  // namespace gfx | 
| OLD | NEW |