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

Side by Side Diff: gpu/command_buffer/service/gl_context_virtual.cc

Issue 2852353003: Add more strict DCHECKs around context state. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('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 "gpu/command_buffer/service/gl_context_virtual.h" 5 #include "gpu/command_buffer/service/gl_context_virtual.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 8 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
10 #include "ui/gl/gl_gl_api_implementation.h" 10 #include "ui/gl/gl_gl_api_implementation.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (IsCurrent(surface)) { 44 if (IsCurrent(surface)) {
45 shared_context_->OnReleaseVirtuallyCurrent(this); 45 shared_context_->OnReleaseVirtuallyCurrent(this);
46 shared_context_->ReleaseCurrent(surface); 46 shared_context_->ReleaseCurrent(surface);
47 } 47 }
48 } 48 }
49 49
50 bool GLContextVirtual::IsCurrent(gl::GLSurface* surface) { 50 bool GLContextVirtual::IsCurrent(gl::GLSurface* surface) {
51 // If it's a real surface it needs to be current. 51 // If it's a real surface it needs to be current.
52 if (surface && 52 if (surface &&
53 !surface->IsOffscreen()) 53 !surface->IsOffscreen())
54 return shared_context_->IsCurrent(surface); 54 return shared_context_->IsCurrent(surface) &&
55 shared_context_->current_virtual_context_ == this;
55 56
56 // Otherwise, only insure the context itself is current. 57 // Otherwise, only insure the context itself is current.
57 return shared_context_->IsCurrent(NULL); 58 return shared_context_->IsCurrent(NULL) &&
59 shared_context_->current_virtual_context_ == this;
piman 2017/05/03 19:47:41 One feature of this code is to avoid calling eglMa
Zhenyao Mo 2017/05/03 22:21:34 Thanks for pointing this out, although this design
58 } 60 }
59 61
60 void* GLContextVirtual::GetHandle() { 62 void* GLContextVirtual::GetHandle() {
61 return shared_context_->GetHandle(); 63 return shared_context_->GetHandle();
62 } 64 }
63 65
64 scoped_refptr<gl::GPUTimingClient> GLContextVirtual::CreateGPUTimingClient() { 66 scoped_refptr<gl::GPUTimingClient> GLContextVirtual::CreateGPUTimingClient() {
65 return shared_context_->CreateGPUTimingClient(); 67 return shared_context_->CreateGPUTimingClient();
66 } 68 }
67 69
(...skipping 30 matching lines...) Expand all
98 100
99 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { 101 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() {
100 return shared_context_->GetYUVToRGBConverter(); 102 return shared_context_->GetYUVToRGBConverter();
101 } 103 }
102 104
103 GLContextVirtual::~GLContextVirtual() { 105 GLContextVirtual::~GLContextVirtual() {
104 Destroy(); 106 Destroy();
105 } 107 }
106 108
107 } // namespace gpu 109 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698