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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 if (!canceled_ && GetCurrent()) { | 36 if (!canceled_ && GetCurrent()) { |
37 GetCurrent()->ReleaseCurrent(nullptr); | 37 GetCurrent()->ReleaseCurrent(nullptr); |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 void GLContext::ScopedReleaseCurrent::Cancel() { | 41 void GLContext::ScopedReleaseCurrent::Cancel() { |
42 canceled_ = true; | 42 canceled_ = true; |
43 } | 43 } |
44 | 44 |
45 GLContext::GLContext(GLShareGroup* share_group) : | 45 GLContext::GLContext(GLShareGroup* share_group) : |
| 46 format_(GLSurface::GetDefaultFormat()), |
46 share_group_(share_group), | 47 share_group_(share_group), |
47 state_dirtied_externally_(false), | 48 state_dirtied_externally_(false), |
48 swap_interval_(1), | 49 swap_interval_(1), |
49 force_swap_interval_zero_(false), | 50 force_swap_interval_zero_(false), |
50 state_dirtied_callback_( | 51 state_dirtied_callback_( |
51 base::Bind(&GLContext::SetStateWasDirtiedExternally, | 52 base::Bind(&GLContext::SetStateWasDirtiedExternally, |
52 // Note that if this is not unretained, it will create a cycle (and | 53 // Note that if this is not unretained, it will create a cycle (and |
53 // will never be freed. | 54 // will never be freed. |
54 base::Unretained(this), | 55 base::Unretained(this), |
55 true)) { | 56 true)) { |
(...skipping 14 matching lines...) Expand all Loading... |
70 } | 71 } |
71 | 72 |
72 bool GLContext::ForceGpuSwitchIfNeeded() { | 73 bool GLContext::ForceGpuSwitchIfNeeded() { |
73 return true; | 74 return true; |
74 } | 75 } |
75 | 76 |
76 void GLContext::SetUnbindFboOnMakeCurrent() { | 77 void GLContext::SetUnbindFboOnMakeCurrent() { |
77 NOTIMPLEMENTED(); | 78 NOTIMPLEMENTED(); |
78 } | 79 } |
79 | 80 |
| 81 void GLContext::UpdateSharedContext(GLContext* context) { |
| 82 NOTIMPLEMENTED(); |
| 83 } |
| 84 |
80 std::string GLContext::GetExtensions() { | 85 std::string GLContext::GetExtensions() { |
81 DCHECK(IsCurrent(nullptr)); | 86 DCHECK(IsCurrent(nullptr)); |
82 return GetGLExtensionsFromCurrentContext(); | 87 return GetGLExtensionsFromCurrentContext(); |
83 } | 88 } |
84 | 89 |
85 std::string GLContext::GetGLVersion() { | 90 std::string GLContext::GetGLVersion() { |
86 DCHECK(IsCurrent(nullptr)); | 91 DCHECK(IsCurrent(nullptr)); |
87 const char *version = | 92 const char *version = |
88 reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 93 reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
89 return std::string(version ? version : ""); | 94 return std::string(version ? version : ""); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 246 } |
242 | 247 |
243 GLContextReal::~GLContextReal() {} | 248 GLContextReal::~GLContextReal() {} |
244 | 249 |
245 void GLContextReal::SetCurrent(GLSurface* surface) { | 250 void GLContextReal::SetCurrent(GLSurface* surface) { |
246 GLContext::SetCurrent(surface); | 251 GLContext::SetCurrent(surface); |
247 current_real_context_.Pointer()->Set(surface ? this : nullptr); | 252 current_real_context_.Pointer()->Set(surface ? this : nullptr); |
248 } | 253 } |
249 | 254 |
250 } // namespace gfx | 255 } // namespace gfx |
OLD | NEW |