Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: ui/gl/gl_context_cgl.cc

Issue 2014223002: Follow-up fixes to changing namespace gfx to gl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_context_cgl.h ('k') | ui/gl/gl_context_stub_with_extensions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include <memory> 10 #include <memory>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Contexts that prefer integrated gpu are known to use only the subset of GL 132 // Contexts that prefer integrated gpu are known to use only the subset of GL
133 // that can be safely migrated between the iGPU and the dGPU. Mark those 133 // that can be safely migrated between the iGPU and the dGPU. Mark those
134 // contexts as safe to forcibly transition between the GPUs by default. 134 // contexts as safe to forcibly transition between the GPUs by default.
135 // http://crbug.com/180876, http://crbug.com/227228 135 // http://crbug.com/180876, http://crbug.com/227228
136 safe_to_force_gpu_switch_ = gpu_preference == PreferIntegratedGpu; 136 safe_to_force_gpu_switch_ = gpu_preference == PreferIntegratedGpu;
137 return true; 137 return true;
138 } 138 }
139 139
140 void GLContextCGL::Destroy() { 140 void GLContextCGL::Destroy() {
141 if (yuv_to_rgb_converter_) { 141 if (yuv_to_rgb_converter_) {
142 gl::ScopedCGLSetCurrentContext(static_cast<CGLContextObj>(context_)); 142 ScopedCGLSetCurrentContext(static_cast<CGLContextObj>(context_));
143 yuv_to_rgb_converter_.reset(); 143 yuv_to_rgb_converter_.reset();
144 } 144 }
145 if (discrete_pixelformat_) { 145 if (discrete_pixelformat_) {
146 if (base::MessageLoop::current() != nullptr) { 146 if (base::MessageLoop::current() != nullptr) {
147 // Delay releasing the pixel format for 10 seconds to reduce the number of 147 // Delay releasing the pixel format for 10 seconds to reduce the number of
148 // unnecessary GPU switches. 148 // unnecessary GPU switches.
149 base::MessageLoop::current()->PostDelayedTask( 149 base::MessageLoop::current()->PostDelayedTask(
150 FROM_HERE, base::Bind(&CGLReleasePixelFormat, discrete_pixelformat_), 150 FROM_HERE, base::Bind(&CGLReleasePixelFormat, discrete_pixelformat_),
151 base::TimeDelta::FromSeconds(10)); 151 base::TimeDelta::FromSeconds(10));
152 } else { 152 } else {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 screen_ = i; 194 screen_ = i;
195 break; 195 break;
196 } 196 }
197 } 197 }
198 renderer_id_ = renderer_id; 198 renderer_id_ = renderer_id;
199 } 199 }
200 } 200 }
201 return true; 201 return true;
202 } 202 }
203 203
204 gl::YUVToRGBConverter* GLContextCGL::GetYUVToRGBConverter() { 204 YUVToRGBConverter* GLContextCGL::GetYUVToRGBConverter() {
205 if (!yuv_to_rgb_converter_) 205 if (!yuv_to_rgb_converter_)
206 yuv_to_rgb_converter_.reset(new gl::YUVToRGBConverter); 206 yuv_to_rgb_converter_.reset(new YUVToRGBConverter);
207 return yuv_to_rgb_converter_.get(); 207 return yuv_to_rgb_converter_.get();
208 } 208 }
209 209
210 bool GLContextCGL::MakeCurrent(GLSurface* surface) { 210 bool GLContextCGL::MakeCurrent(GLSurface* surface) {
211 DCHECK(context_); 211 DCHECK(context_);
212 212
213 if (!ForceGpuSwitchIfNeeded()) 213 if (!ForceGpuSwitchIfNeeded())
214 return false; 214 return false;
215 215
216 if (IsCurrent(surface)) 216 if (IsCurrent(surface))
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 GLContextCGL::~GLContextCGL() { 280 GLContextCGL::~GLContextCGL() {
281 Destroy(); 281 Destroy();
282 } 282 }
283 283
284 GpuPreference GLContextCGL::GetGpuPreference() { 284 GpuPreference GLContextCGL::GetGpuPreference() {
285 return gpu_preference_; 285 return gpu_preference_;
286 } 286 }
287 287
288 } // namespace gl 288 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_context_cgl.h ('k') | ui/gl/gl_context_stub_with_extensions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698