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_context.h" | 5 #include "ui/gl/gl_context.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() { | 37 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() { |
38 if (!canceled_ && GetCurrent()) { | 38 if (!canceled_ && GetCurrent()) { |
39 GetCurrent()->ReleaseCurrent(nullptr); | 39 GetCurrent()->ReleaseCurrent(nullptr); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 void GLContext::ScopedReleaseCurrent::Cancel() { | 43 void GLContext::ScopedReleaseCurrent::Cancel() { |
44 canceled_ = true; | 44 canceled_ = true; |
45 } | 45 } |
46 | 46 |
| 47 GLWorkarounds GLContext::gl_workarounds_; |
| 48 |
| 49 // static |
| 50 void GLContext::SetGLWorkarounds(const GLWorkarounds& workarounds) { |
| 51 gl_workarounds_ = workarounds; |
| 52 } |
| 53 |
| 54 // static |
| 55 GLWorkarounds GLContext::GetGLWorkarounds() { |
| 56 return gl_workarounds_; |
| 57 } |
| 58 |
47 GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) { | 59 GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) { |
48 if (!share_group_.get()) | 60 if (!share_group_.get()) |
49 share_group_ = new gl::GLShareGroup(); | 61 share_group_ = new gl::GLShareGroup(); |
50 share_group_->AddContext(this); | 62 share_group_->AddContext(this); |
51 } | 63 } |
52 | 64 |
53 GLContext::~GLContext() { | 65 GLContext::~GLContext() { |
54 share_group_->RemoveContext(this); | 66 share_group_->RemoveContext(this); |
55 if (GetCurrent() == this) { | 67 if (GetCurrent() == this) { |
56 SetCurrent(nullptr); | 68 SetCurrent(nullptr); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 351 |
340 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, | 352 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, |
341 GLSurface* compatible_surface, | 353 GLSurface* compatible_surface, |
342 const GLContextAttribs& attribs) { | 354 const GLContextAttribs& attribs) { |
343 if (!context->Initialize(compatible_surface, attribs)) | 355 if (!context->Initialize(compatible_surface, attribs)) |
344 return nullptr; | 356 return nullptr; |
345 return context; | 357 return context; |
346 } | 358 } |
347 | 359 |
348 } // namespace gl | 360 } // namespace gl |
OLD | NEW |