| 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/client/gl_in_process_context.h" | 5 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 base::Closure context_lost_callback_; | 84 base::Closure context_lost_callback_; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); | 86 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 base::LazyInstance<base::Lock> g_all_shared_contexts_lock = | 89 base::LazyInstance<base::Lock> g_all_shared_contexts_lock = |
| 90 LAZY_INSTANCE_INITIALIZER; | 90 LAZY_INSTANCE_INITIALIZER; |
| 91 base::LazyInstance<std::set<GLInProcessContextImpl*> > g_all_shared_contexts = | 91 base::LazyInstance<std::set<GLInProcessContextImpl*> > g_all_shared_contexts = |
| 92 LAZY_INSTANCE_INITIALIZER; | 92 LAZY_INSTANCE_INITIALIZER; |
| 93 | 93 |
| 94 size_t SharedContextCount() { | |
| 95 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | |
| 96 return g_all_shared_contexts.Get().size(); | |
| 97 } | |
| 98 | |
| 99 GLInProcessContextImpl::GLInProcessContextImpl() | 94 GLInProcessContextImpl::GLInProcessContextImpl() |
| 100 : share_group_id_(0), context_lost_(false) {} | 95 : share_group_id_(0), context_lost_(false) {} |
| 101 | 96 |
| 102 GLInProcessContextImpl::~GLInProcessContextImpl() { | 97 GLInProcessContextImpl::~GLInProcessContextImpl() { |
| 103 { | 98 { |
| 104 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 99 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
| 105 g_all_shared_contexts.Get().erase(this); | 100 g_all_shared_contexts.Get().erase(this); |
| 106 } | 101 } |
| 107 Destroy(); | 102 Destroy(); |
| 108 } | 103 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 gfx::kNullAcceleratedWidget, | 320 gfx::kNullAcceleratedWidget, |
| 326 surface->GetSize(), | 321 surface->GetSize(), |
| 327 attribs, | 322 attribs, |
| 328 gpu_preference)) | 323 gpu_preference)) |
| 329 return NULL; | 324 return NULL; |
| 330 | 325 |
| 331 return context.release(); | 326 return context.release(); |
| 332 } | 327 } |
| 333 | 328 |
| 334 } // namespace gpu | 329 } // namespace gpu |
| OLD | NEW |