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_cgl.h" | 5 #include "ui/gl/gl_context_cgl.h" |
6 | 6 |
7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
8 #include <OpenGL/CGLTypes.h> | 8 #include <OpenGL/CGLTypes.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 gpu_preference_ = gpu_preference; | 107 gpu_preference_ = gpu_preference; |
108 return true; | 108 return true; |
109 } | 109 } |
110 | 110 |
111 void GLContextCGL::Destroy() { | 111 void GLContextCGL::Destroy() { |
112 if (discrete_pixelformat_) { | 112 if (discrete_pixelformat_) { |
113 // Delay releasing the pixel format for 10 seconds to reduce the number of | 113 // Delay releasing the pixel format for 10 seconds to reduce the number of |
114 // unnecessary GPU switches. | 114 // unnecessary GPU switches. |
115 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 115 base::MessageLoop::current()->PostDelayedTask( |
116 base::Bind(&CGLReleasePixelFormat, | 116 FROM_HERE, |
117 discrete_pixelformat_), | 117 base::Bind(&CGLReleasePixelFormat, discrete_pixelformat_), |
118 base::TimeDelta::FromSeconds(10)); | 118 base::TimeDelta::FromSeconds(10)); |
119 discrete_pixelformat_ = NULL; | 119 discrete_pixelformat_ = NULL; |
120 } | 120 } |
121 if (context_) { | 121 if (context_) { |
122 CGLDestroyContext(static_cast<CGLContextObj>(context_)); | 122 CGLDestroyContext(static_cast<CGLContextObj>(context_)); |
123 context_ = NULL; | 123 context_ = NULL; |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 bool GLContextCGL::MakeCurrent(GLSurface* surface) { | 127 bool GLContextCGL::MakeCurrent(GLSurface* surface) { |
128 DCHECK(context_); | 128 DCHECK(context_); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 GpuPreference GLContextCGL::GetGpuPreference() { | 285 GpuPreference GLContextCGL::GetGpuPreference() { |
286 return gpu_preference_; | 286 return gpu_preference_; |
287 } | 287 } |
288 | 288 |
289 void ScopedCGLDestroyRendererInfo::operator()(CGLRendererInfoObj x) const { | 289 void ScopedCGLDestroyRendererInfo::operator()(CGLRendererInfoObj x) const { |
290 CGLDestroyRendererInfo(x); | 290 CGLDestroyRendererInfo(x); |
291 } | 291 } |
292 | 292 |
293 } // namespace gfx | 293 } // namespace gfx |
OLD | NEW |