OLD | NEW |
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/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 } // namespace anonymous | 245 } // namespace anonymous |
246 | 246 |
247 bool ContextGroup::HaveContexts() { | 247 bool ContextGroup::HaveContexts() { |
248 decoders_.erase(std::remove_if(decoders_.begin(), decoders_.end(), IsNull), | 248 decoders_.erase(std::remove_if(decoders_.begin(), decoders_.end(), IsNull), |
249 decoders_.end()); | 249 decoders_.end()); |
250 return !decoders_.empty(); | 250 return !decoders_.empty(); |
251 } | 251 } |
252 | 252 |
253 void ContextGroup::Destroy(GLES2Decoder* decoder, bool have_context) { | 253 void ContextGroup::Destroy(GLES2Decoder* decoder, bool have_context) { |
254 decoders_.erase(std::remove(decoders_.begin(), decoders_.end(), decoder), | 254 decoders_.erase(std::remove(decoders_.begin(), decoders_.end(), |
| 255 decoder->AsWeakPtr()), |
255 decoders_.end()); | 256 decoders_.end()); |
256 // If we still have contexts do nothing. | 257 // If we still have contexts do nothing. |
257 if (HaveContexts()) { | 258 if (HaveContexts()) { |
258 return; | 259 return; |
259 } | 260 } |
260 | 261 |
261 if (buffer_manager_ != NULL) { | 262 if (buffer_manager_ != NULL) { |
262 buffer_manager_->Destroy(have_context); | 263 buffer_manager_->Destroy(have_context); |
263 buffer_manager_.reset(); | 264 buffer_manager_.reset(); |
264 } | 265 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 GLenum pname, GLint min_required, uint32* v) { | 354 GLenum pname, GLint min_required, uint32* v) { |
354 uint32 value = 0; | 355 uint32 value = 0; |
355 GetIntegerv(pname, &value); | 356 GetIntegerv(pname, &value); |
356 bool result = CheckGLFeatureU(min_required, &value); | 357 bool result = CheckGLFeatureU(min_required, &value); |
357 *v = value; | 358 *v = value; |
358 return result; | 359 return result; |
359 } | 360 } |
360 | 361 |
361 } // namespace gles2 | 362 } // namespace gles2 |
362 } // namespace gpu | 363 } // namespace gpu |
OLD | NEW |