OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/gles2_cmd_decoder_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/feature_info.h" | 7 #include "gpu/command_buffer/service/feature_info.h" |
8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
9 #include "ui/gl/gl_version_info.h" | 9 #include "ui/gl/gl_version_info.h" |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 DeleteServiceObjects(&transform_feedback_id_map_, have_context, | 216 DeleteServiceObjects(&transform_feedback_id_map_, have_context, |
217 [](GLuint transform_feedback) { | 217 [](GLuint transform_feedback) { |
218 glDeleteTransformFeedbacks(1, &transform_feedback); | 218 glDeleteTransformFeedbacks(1, &transform_feedback); |
219 }); | 219 }); |
220 DeleteServiceObjects(&query_id_map_, have_context, | 220 DeleteServiceObjects(&query_id_map_, have_context, |
221 [](GLuint query) { glDeleteQueries(1, &query); }); | 221 [](GLuint query) { glDeleteQueries(1, &query); }); |
222 DeleteServiceObjects( | 222 DeleteServiceObjects( |
223 &vertex_array_id_map_, have_context, | 223 &vertex_array_id_map_, have_context, |
224 [](GLuint vertex_array) { glDeleteVertexArraysOES(1, &vertex_array); }); | 224 [](GLuint vertex_array) { glDeleteVertexArraysOES(1, &vertex_array); }); |
225 | 225 |
| 226 // Destroy the surface before the context, some surface destructors make GL |
| 227 // calls. |
| 228 surface_ = nullptr; |
| 229 |
226 if (group_) { | 230 if (group_) { |
227 group_->Destroy(this, have_context); | 231 group_->Destroy(this, have_context); |
228 group_ = nullptr; | 232 group_ = nullptr; |
229 } | 233 } |
| 234 |
| 235 if (context_.get()) { |
| 236 context_->ReleaseCurrent(nullptr); |
| 237 context_ = nullptr; |
| 238 } |
230 } | 239 } |
231 | 240 |
232 void GLES2DecoderPassthroughImpl::SetSurface( | 241 void GLES2DecoderPassthroughImpl::SetSurface( |
233 const scoped_refptr<gl::GLSurface>& surface) { | 242 const scoped_refptr<gl::GLSurface>& surface) { |
234 DCHECK(context_->IsCurrent(nullptr)); | 243 DCHECK(context_->IsCurrent(nullptr)); |
235 DCHECK(surface_.get()); | 244 DCHECK(surface_.get()); |
236 surface_ = surface; | 245 surface_ = surface; |
237 } | 246 } |
238 | 247 |
239 void GLES2DecoderPassthroughImpl::ReleaseSurface() { | 248 void GLES2DecoderPassthroughImpl::ReleaseSurface() { |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 }, /* NOLINT */ | 849 }, /* NOLINT */ |
841 | 850 |
842 const GLES2DecoderPassthroughImpl::CommandInfo | 851 const GLES2DecoderPassthroughImpl::CommandInfo |
843 GLES2DecoderPassthroughImpl::command_info[] = { | 852 GLES2DecoderPassthroughImpl::command_info[] = { |
844 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; | 853 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
845 | 854 |
846 #undef GLES2_CMD_OP | 855 #undef GLES2_CMD_OP |
847 | 856 |
848 } // namespace gles2 | 857 } // namespace gles2 |
849 } // namespace gpu | 858 } // namespace gpu |
OLD | NEW |