OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/compositor/compositor.h" | 5 #include "ui/gfx/compositor/compositor.h" |
6 | 6 |
7 #include <GL/gl.h> | 7 #include <GL/gl.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/threading/thread_restrictions.h" | |
14 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "third_party/skia/include/core/SkMatrix.h" | 14 #include "third_party/skia/include/core/SkMatrix.h" |
16 #include "third_party/skia/include/core/SkScalar.h" | 15 #include "third_party/skia/include/core/SkScalar.h" |
17 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
18 #include "ui/gfx/transform.h" | 17 #include "ui/gfx/transform.h" |
19 #include "ui/gfx/gl/gl_bindings.h" | 18 #include "ui/gfx/gl/gl_bindings.h" |
20 #include "ui/gfx/gl/gl_context.h" | 19 #include "ui/gfx/gl/gl_context.h" |
21 #include "ui/gfx/gl/gl_implementation.h" | 20 #include "ui/gfx/gl/gl_implementation.h" |
22 #include "ui/gfx/gl/gl_surface.h" | 21 #include "ui/gfx/gl/gl_surface.h" |
23 #include "ui/gfx/gl/gl_surface_glx.h" | 22 #include "ui/gfx/gl/gl_surface_glx.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 void CompositorGL::NotifyEnd() { | 235 void CompositorGL::NotifyEnd() { |
237 DCHECK(started_); | 236 DCHECK(started_); |
238 gl_context_->SwapBuffers(); | 237 gl_context_->SwapBuffers(); |
239 started_ = false; | 238 started_ = false; |
240 } | 239 } |
241 | 240 |
242 } // namespace | 241 } // namespace |
243 | 242 |
244 // static | 243 // static |
245 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { | 244 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { |
246 // The following line of code exists soley to disable IO restrictions | |
247 // on this thread long enough to perform the GL bindings. | |
248 // TODO(backer) Remove this when GL initialisation cleaned up. | |
249 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
250 // TODO(backer) Remove this when GL thread patch lands. Should be init'd | 245 // TODO(backer) Remove this when GL thread patch lands. Should be init'd |
251 // by the new GPU thread. | 246 // by the new GPU thread. |
252 // http://codereview.chromium.org/6677055/ | 247 // http://codereview.chromium.org/6677055/ |
253 gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); | 248 gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); |
254 gfx::GLSurfaceGLX::InitializeOneOff(); | 249 gfx::GLSurfaceGLX::InitializeOneOff(); |
255 | 250 |
256 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) | 251 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) |
257 return new glHidden::CompositorGL(widget); | 252 return new glHidden::CompositorGL(widget); |
258 return NULL; | 253 return NULL; |
259 } | 254 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 313 |
319 // static | 314 // static |
320 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { | 315 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { |
321 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) | 316 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) |
322 return new CompositorGL(widget); | 317 return new CompositorGL(widget); |
323 return NULL; | 318 return NULL; |
324 } | 319 } |
325 #endif | 320 #endif |
326 | 321 |
327 } // namespace ui | 322 } // namespace ui |
OLD | NEW |