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 "../client/atomicops.h" | 5 #include "../client/atomicops.h" |
6 #include "../client/share_group.h" | 6 #include "../client/share_group.h" |
7 #include "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
8 #include "../client/program_info_manager.h" | 8 #include "../client/program_info_manager.h" |
9 #include "../common/id_allocator.h" | 9 #include "../common/id_allocator.h" |
10 #include "../common/logging.h" | 10 #include "../common/logging.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 private: | 191 private: |
192 IdHandlerInterface* id_handler_; | 192 IdHandlerInterface* id_handler_; |
193 Lock lock_; | 193 Lock lock_; |
194 }; | 194 }; |
195 | 195 |
196 ShareGroup::ShareGroup(bool share_resources, bool bind_generates_resource) | 196 ShareGroup::ShareGroup(bool share_resources, bool bind_generates_resource) |
197 : sharing_resources_(share_resources), | 197 : sharing_resources_(share_resources), |
198 bind_generates_resource_(bind_generates_resource), | 198 bind_generates_resource_(bind_generates_resource), |
199 gles2_(NULL) { | 199 gles2_(NULL) { |
200 GPU_CHECK(ShareGroup::ImplementsThreadSafeReferenceCounting()); | |
201 | |
202 if (bind_generates_resource) { | 200 if (bind_generates_resource) { |
203 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { | 201 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { |
204 if (i == id_namespaces::kProgramsAndShaders) { | 202 if (i == id_namespaces::kProgramsAndShaders) { |
205 id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( | 203 id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( |
206 new NonReusedIdHandler())); | 204 new NonReusedIdHandler())); |
207 } else { | 205 } else { |
208 id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( | 206 id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( |
209 new IdHandler())); | 207 new IdHandler())); |
210 } | 208 } |
211 } | 209 } |
(...skipping 22 matching lines...) Expand all Loading... |
234 | 232 |
235 ShareGroup::~ShareGroup() { | 233 ShareGroup::~ShareGroup() { |
236 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { | 234 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { |
237 id_handlers_[i]->Destroy(gles2_); | 235 id_handlers_[i]->Destroy(gles2_); |
238 id_handlers_[i].reset(); | 236 id_handlers_[i].reset(); |
239 } | 237 } |
240 } | 238 } |
241 | 239 |
242 } // namespace gles2 | 240 } // namespace gles2 |
243 } // namespace gpu | 241 } // namespace gpu |
OLD | NEW |