Chromium Code Reviews| 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 "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 << " GL implementation."; | 88 << " GL implementation."; |
| 89 if (gpu_service_logging) | 89 if (gpu_service_logging) |
| 90 InitializeDebugGLBindings(); | 90 InitializeDebugGLBindings(); |
| 91 if (disable_gl_drawing) | 91 if (disable_gl_drawing) |
| 92 InitializeNullDrawGLBindings(); | 92 InitializeNullDrawGLBindings(); |
| 93 } | 93 } |
| 94 return initialized; | 94 return initialized; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 void GLSurface::InitializeOneOffForTests(bool disable_drawing) { | 98 void GLSurface::InitializeOneOffForTests(bool disable_drawing) { |
|
danakj
2014/03/03 18:08:04
I'll remove this disable_drawing flag in a next CL
| |
| 99 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 99 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |
| 100 | 100 |
| 101 #if defined(USE_X11) | 101 #if defined(USE_X11) |
| 102 XInitThreads(); | 102 XInitThreads(); |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 bool use_osmesa = true; | 105 bool use_osmesa = true; |
| 106 | 106 |
| 107 // We usually use OSMesa as this works on all bots. The command line can | 107 // We usually use OSMesa as this works on all bots. The command line can |
| 108 // override this behaviour to use hardware GL. | 108 // override this behaviour to use hardware GL. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 120 | 120 |
| 121 GLImplementation impl = allowed_impls[0]; | 121 GLImplementation impl = allowed_impls[0]; |
| 122 if (use_osmesa) | 122 if (use_osmesa) |
| 123 impl = kGLImplementationOSMesaGL; | 123 impl = kGLImplementationOSMesaGL; |
| 124 | 124 |
| 125 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 125 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
| 126 << "kUseGL has not effect in tests"; | 126 << "kUseGL has not effect in tests"; |
| 127 | 127 |
| 128 bool fallback_to_osmesa = false; | 128 bool fallback_to_osmesa = false; |
| 129 bool gpu_service_logging = false; | 129 bool gpu_service_logging = false; |
| 130 bool disable_gl_drawing = disable_drawing; | 130 // Unit tests do not produce pixel output by default. |
| 131 // TODO(danakj): Unit tests do not produce pixel output by default. | 131 bool disable_gl_drawing = true; |
| 132 // bool disable_gl_drawing = true; | |
| 133 | 132 |
| 134 CHECK(InitializeOneOffImplementation( | 133 CHECK(InitializeOneOffImplementation( |
| 135 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); | 134 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); |
| 136 } | 135 } |
| 137 | 136 |
| 138 // static | 137 // static |
| 139 void GLSurface::InitializeOneOffWithMockBindingsForTests() { | 138 void GLSurface::InitializeOneOffWithMockBindingsForTests() { |
| 140 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 139 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
| 141 << "kUseGL has not effect in tests"; | 140 << "kUseGL has not effect in tests"; |
| 142 | 141 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 return surface_->GetFormat(); | 339 return surface_->GetFormat(); |
| 341 } | 340 } |
| 342 | 341 |
| 343 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { | 342 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { |
| 344 return surface_->GetVSyncProvider(); | 343 return surface_->GetVSyncProvider(); |
| 345 } | 344 } |
| 346 | 345 |
| 347 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 346 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
| 348 | 347 |
| 349 } // namespace gfx | 348 } // namespace gfx |
| OLD | NEW |