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() { |
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 bool disable_gl_drawing = true; |
131 // TODO(danakj): Unit tests do not produce pixel output by default. | |
132 // bool disable_gl_drawing = true; | |
133 | 131 |
134 CHECK(InitializeOneOffImplementation( | 132 CHECK(InitializeOneOffImplementation( |
135 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); | 133 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); |
136 } | 134 } |
137 | 135 |
138 // static | 136 // static |
139 void GLSurface::InitializeOneOffWithMockBindingsForTests() { | 137 void GLSurface::InitializeOneOffWithMockBindingsForTests() { |
140 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 138 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
141 << "kUseGL has not effect in tests"; | 139 << "kUseGL has not effect in tests"; |
142 | 140 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 return surface_->GetFormat(); | 338 return surface_->GetFormat(); |
341 } | 339 } |
342 | 340 |
343 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { | 341 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { |
344 return surface_->GetVSyncProvider(); | 342 return surface_->GetVSyncProvider(); |
345 } | 343 } |
346 | 344 |
347 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 345 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
348 | 346 |
349 } // namespace gfx | 347 } // namespace gfx |
OLD | NEW |