Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: gpu/command_buffer/service/shader_translator_cache.cc

Issue 217813004: Make ShaderTranslatorCache thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: protect ShFinalize Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shader_translator_cache.h" 5 #include "gpu/command_buffer/service/shader_translator_cache.h"
6 6
7 namespace gpu { 7 namespace gpu {
8 namespace gles2 { 8 namespace gles2 {
9 9
10 ShaderTranslatorCache* ShaderTranslatorCache::GetInstance() {
11 return Singleton<ShaderTranslatorCache>::get();
12 }
13
14 ShaderTranslatorCache::ShaderTranslatorCache() { 10 ShaderTranslatorCache::ShaderTranslatorCache() {
15 } 11 }
16 12
17 ShaderTranslatorCache::~ShaderTranslatorCache() { 13 ShaderTranslatorCache::~ShaderTranslatorCache() {
18 } 14 }
19 15
20 void ShaderTranslatorCache::OnDestruct(ShaderTranslator* translator) { 16 void ShaderTranslatorCache::OnDestruct(ShaderTranslator* translator) {
21 Cache::iterator it = cache_.begin(); 17 Cache::iterator it = cache_.begin();
22 while (it != cache_.end()) { 18 while (it != cache_.end()) {
23 if (it->second == translator) { 19 if (it->second == translator) {
(...skipping 28 matching lines...) Expand all
52 cache_[params] = translator; 48 cache_[params] = translator;
53 translator->AddDestructionObserver(this); 49 translator->AddDestructionObserver(this);
54 return translator; 50 return translator;
55 } else { 51 } else {
56 return NULL; 52 return NULL;
57 } 53 }
58 } 54 }
59 55
60 } // namespace gles2 56 } // namespace gles2
61 } // namespace gpu 57 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698