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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return false; | 232 return false; |
233 } | 233 } |
234 | 234 |
235 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 235 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
236 return true; | 236 return true; |
237 } | 237 } |
238 | 238 |
239 namespace { | 239 namespace { |
240 | 240 |
241 bool IsNull(const base::WeakPtr<gles2::GLES2Decoder>& decoder) { | 241 bool IsNull(const base::WeakPtr<gles2::GLES2Decoder>& decoder) { |
242 return !decoder; | 242 return !decoder.get(); |
243 } | 243 } |
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 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 total += buffer_manager_->mem_represented(); | 306 total += buffer_manager_->mem_represented(); |
307 if (renderbuffer_manager_.get()) | 307 if (renderbuffer_manager_.get()) |
308 total += renderbuffer_manager_->mem_represented(); | 308 total += renderbuffer_manager_->mem_represented(); |
309 if (texture_manager_.get()) | 309 if (texture_manager_.get()) |
310 total += texture_manager_->mem_represented(); | 310 total += texture_manager_->mem_represented(); |
311 return total; | 311 return total; |
312 } | 312 } |
313 | 313 |
314 void ContextGroup::LoseContexts(GLenum reset_status) { | 314 void ContextGroup::LoseContexts(GLenum reset_status) { |
315 for (size_t ii = 0; ii < decoders_.size(); ++ii) { | 315 for (size_t ii = 0; ii < decoders_.size(); ++ii) { |
316 if (decoders_[ii]) { | 316 if (decoders_[ii].get()) { |
317 decoders_[ii]->LoseContext(reset_status); | 317 decoders_[ii]->LoseContext(reset_status); |
318 } | 318 } |
319 } | 319 } |
320 } | 320 } |
321 | 321 |
322 ContextGroup::~ContextGroup() { | 322 ContextGroup::~ContextGroup() { |
323 CHECK(!HaveContexts()); | 323 CHECK(!HaveContexts()); |
324 } | 324 } |
325 | 325 |
326 bool ContextGroup::CheckGLFeature(GLint min_required, GLint* v) { | 326 bool ContextGroup::CheckGLFeature(GLint min_required, GLint* v) { |
(...skipping 26 matching lines...) Expand all Loading... |
353 GLenum pname, GLint min_required, uint32* v) { | 353 GLenum pname, GLint min_required, uint32* v) { |
354 uint32 value = 0; | 354 uint32 value = 0; |
355 GetIntegerv(pname, &value); | 355 GetIntegerv(pname, &value); |
356 bool result = CheckGLFeatureU(min_required, &value); | 356 bool result = CheckGLFeatureU(min_required, &value); |
357 *v = value; | 357 *v = value; |
358 return result; | 358 return result; |
359 } | 359 } |
360 | 360 |
361 } // namespace gles2 | 361 } // namespace gles2 |
362 } // namespace gpu | 362 } // namespace gpu |
OLD | NEW |