| 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" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/threading/thread_local.h" | 13 #include "base/threading/thread_local.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "ui/gfx/swap_result.h" | 15 #include "ui/gfx/swap_result.h" |
| 16 #include "ui/gl/gl_context.h" | 16 #include "ui/gl/gl_context.h" |
| 17 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/gl/gl_switches.h" | 18 #include "ui/gl/gl_switches.h" |
| 19 | 19 |
| 20 #if defined(USE_X11) | 20 #if defined(USE_X11) |
| 21 #include <X11/Xlib.h> | 21 #include <X11/Xlib.h> |
| 22 #include "ui/platform_window/x11/x11_window.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 base::LazyInstance<base::ThreadLocalPointer<GLSurface> >::Leaky | 28 base::LazyInstance<base::ThreadLocalPointer<GLSurface> >::Leaky |
| 28 current_surface_ = LAZY_INSTANCE_INITIALIZER; | 29 current_surface_ = LAZY_INSTANCE_INITIALIZER; |
| 29 } // namespace | 30 } // namespace |
| 30 | 31 |
| 31 // static | 32 // static |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 97 } |
| 97 return initialized; | 98 return initialized; |
| 98 } | 99 } |
| 99 | 100 |
| 100 // static | 101 // static |
| 101 void GLSurface::InitializeOneOffForTests() { | 102 void GLSurface::InitializeOneOffForTests() { |
| 102 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 103 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |
| 103 | 104 |
| 104 #if defined(USE_X11) | 105 #if defined(USE_X11) |
| 105 XInitThreads(); | 106 XInitThreads(); |
| 107 ui::test::SetUseOverrideRedirectWindowByDefault(true); |
| 106 #endif | 108 #endif |
| 107 | 109 |
| 108 bool use_osmesa = true; | 110 bool use_osmesa = true; |
| 109 | 111 |
| 110 // We usually use OSMesa as this works on all bots. The command line can | 112 // We usually use OSMesa as this works on all bots. The command line can |
| 111 // override this behaviour to use hardware GL. | 113 // override this behaviour to use hardware GL. |
| 112 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 114 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 113 switches::kUseGpuInTests)) | 115 switches::kUseGpuInTests)) |
| 114 use_osmesa = false; | 116 use_osmesa = false; |
| 115 | 117 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 z_order, transform, image, bounds_rect, crop_rect); | 401 z_order, transform, image, bounds_rect, crop_rect); |
| 400 } | 402 } |
| 401 | 403 |
| 402 bool GLSurfaceAdapter::IsSurfaceless() const { | 404 bool GLSurfaceAdapter::IsSurfaceless() const { |
| 403 return surface_->IsSurfaceless(); | 405 return surface_->IsSurfaceless(); |
| 404 } | 406 } |
| 405 | 407 |
| 406 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 408 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
| 407 | 409 |
| 408 } // namespace gfx | 410 } // namespace gfx |
| OLD | NEW |