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

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

Issue 8947021: Destroy all Singletons and LazyInstances between each test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NSS Created 7 years, 7 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
« crypto/nss_util.cc ('K') | « crypto/nss_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "gpu/command_buffer/service/shader_translator.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 13
14 namespace { 14 namespace {
15 15
16 using gpu::gles2::ShaderTranslator; 16 using gpu::gles2::ShaderTranslator;
17 17
18 static bool g_shader_initalized = false;
19
18 void FinalizeShaderTranslator(void* /* dummy */) { 20 void FinalizeShaderTranslator(void* /* dummy */) {
19 ShFinalize(); 21 ShFinalize();
22 DCHECK(g_shader_initalized);
23 g_shader_initalized = false;
20 } 24 }
21 25
22 bool InitializeShaderTranslator() { 26 bool InitializeShaderTranslator() {
23 static bool initialized = false; 27 if (!g_shader_initalized && ShInitialize()) {
24 if (!initialized && ShInitialize()) {
25 base::AtExitManager::RegisterCallback(&FinalizeShaderTranslator, NULL); 28 base::AtExitManager::RegisterCallback(&FinalizeShaderTranslator, NULL);
26 initialized = true; 29 g_shader_initalized = true;
27 } 30 }
28 return initialized; 31 return g_shader_initalized;
29 } 32 }
30 33
31 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 34 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108
32 typedef int ANGLEGetInfoType; 35 typedef int ANGLEGetInfoType;
33 #else 36 #else
34 typedef size_t ANGLEGetInfoType; 37 typedef size_t ANGLEGetInfoType;
35 #endif 38 #endif
36 39
37 void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type, 40 void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type,
38 ShaderTranslator::VariableMap* var_map) { 41 ShaderTranslator::VariableMap* var_map) {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 translated_shader_.reset(); 299 translated_shader_.reset();
297 info_log_.reset(); 300 info_log_.reset();
298 attrib_map_.clear(); 301 attrib_map_.clear();
299 uniform_map_.clear(); 302 uniform_map_.clear();
300 name_map_.clear(); 303 name_map_.clear();
301 } 304 }
302 305
303 } // namespace gles2 306 } // namespace gles2
304 } // namespace gpu 307 } // namespace gpu
305 308
OLDNEW
« crypto/nss_util.cc ('K') | « crypto/nss_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698