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

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

Issue 15841002: gpu: Fix corrupted state due to virtual MakeCurrent race. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reland patch. Created 7 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 | « gpu/command_buffer/service/gl_state_restorer_impl.cc ('k') | ui/gl/gl_state_restorer.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_gl_api_implementation.h" 5 #include "ui/gl/gl_gl_api_implementation.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 DCHECK_EQ(glGetErrorFn(), static_cast<GLenum>(GL_NO_ERROR)); 278 DCHECK_EQ(glGetErrorFn(), static_cast<GLenum>(GL_NO_ERROR));
279 279
280 current_context_ = virtual_context; 280 current_context_ = virtual_context;
281 // Set all state that is different from the real state 281 // Set all state that is different from the real state
282 // NOTE: !!! This is a temporary implementation that just restores all 282 // NOTE: !!! This is a temporary implementation that just restores all
283 // state to let us test that it works. 283 // state to let us test that it works.
284 // TODO: ASAP, change this to something that only restores the state 284 // TODO: ASAP, change this to something that only restores the state
285 // needed for individual GL calls. 285 // needed for individual GL calls.
286 GLApi* temp = GetCurrentGLApi(); 286 GLApi* temp = GetCurrentGLApi();
287 SetGLToRealGLApi(); 287 SetGLToRealGLApi();
288 virtual_context->GetGLStateRestorer()->RestoreState(); 288 if (virtual_context->GetGLStateRestorer()->IsInitialized())
289 virtual_context->GetGLStateRestorer()->RestoreState();
289 SetGLApi(temp); 290 SetGLApi(temp);
290 } 291 }
291 SetGLApi(this); 292 SetGLApi(this);
292 return true; 293 return true;
293 } 294 }
294 295
295 void VirtualGLApi::OnDestroyVirtualContext(GLContext* virtual_context) { 296 void VirtualGLApi::OnDestroyVirtualContext(GLContext* virtual_context) {
296 if (current_context_ == virtual_context) 297 if (current_context_ == virtual_context)
297 current_context_ = NULL; 298 current_context_ = NULL;
298 } 299 }
299 300
300 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { 301 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) {
301 switch (name) { 302 switch (name) {
302 case GL_EXTENSIONS: 303 case GL_EXTENSIONS:
303 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); 304 return reinterpret_cast<const GLubyte*>(extensions_.c_str());
304 default: 305 default:
305 return driver_->fn.glGetStringFn(name); 306 return driver_->fn.glGetStringFn(name);
306 } 307 }
307 } 308 }
308 309
309 } // namespace gfx 310 } // namespace gfx
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_state_restorer_impl.cc ('k') | ui/gl/gl_state_restorer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698