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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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.cc ('k') | ui/gl/gl_mock_autogen_gl.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 #include <vector> 9 #include <vector>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 Destroy(); 115 Destroy();
116 return false; 116 return false;
117 } 117 }
118 118
119 gpu_preference_ = gpu_preference; 119 gpu_preference_ = gpu_preference;
120 return true; 120 return true;
121 } 121 }
122 122
123 void GLContextCGL::Destroy() { 123 void GLContextCGL::Destroy() {
124 if (discrete_pixelformat_) { 124 if (discrete_pixelformat_) {
125 if (base::MessageLoop::current() != NULL) { 125 // Delay releasing the pixel format for 10 seconds to reduce the number of
126 // Delay releasing the pixel format for 10 seconds to reduce the number of 126 // unnecessary GPU switches.
127 // unnecessary GPU switches. 127 base::MessageLoop::current()->PostDelayedTask(
128 base::MessageLoop::current()->PostDelayedTask( 128 FROM_HERE,
129 FROM_HERE, base::Bind(&CGLReleasePixelFormat, discrete_pixelformat_), 129 base::Bind(&CGLReleasePixelFormat, discrete_pixelformat_),
130 base::TimeDelta::FromSeconds(10)); 130 base::TimeDelta::FromSeconds(10));
131 } else {
132 CGLReleasePixelFormat(discrete_pixelformat_);
133 }
134 discrete_pixelformat_ = NULL; 131 discrete_pixelformat_ = NULL;
135 } 132 }
136 if (context_) { 133 if (context_) {
137 CGLDestroyContext(static_cast<CGLContextObj>(context_)); 134 CGLDestroyContext(static_cast<CGLContextObj>(context_));
138 context_ = NULL; 135 context_ = NULL;
139 } 136 }
140 } 137 }
141 138
142 bool GLContextCGL::ForceGpuSwitchIfNeeded() { 139 bool GLContextCGL::ForceGpuSwitchIfNeeded() {
143 DCHECK(context_); 140 DCHECK(context_);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 302
306 GLContextCGL::~GLContextCGL() { 303 GLContextCGL::~GLContextCGL() {
307 Destroy(); 304 Destroy();
308 } 305 }
309 306
310 GpuPreference GLContextCGL::GetGpuPreference() { 307 GpuPreference GLContextCGL::GetGpuPreference() {
311 return gpu_preference_; 308 return gpu_preference_;
312 } 309 }
313 310
314 } // namespace gfx 311 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_context.cc ('k') | ui/gl/gl_mock_autogen_gl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698