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

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

Issue 16063002: Revert 202305 "Destroy all Singletons and LazyInstances between ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
« no previous file with comments | « trunk/src/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/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 14
15 namespace { 15 namespace {
16 16
17 using gpu::gles2::ShaderTranslator; 17 using gpu::gles2::ShaderTranslator;
18 18
19 static bool g_shader_initalized = false;
20
21 void FinalizeShaderTranslator(void* /* dummy */) { 19 void FinalizeShaderTranslator(void* /* dummy */) {
22 TRACE_EVENT0("gpu", "ShFinalize"); 20 TRACE_EVENT0("gpu", "ShFinalize");
23 ShFinalize(); 21 ShFinalize();
24 DCHECK(g_shader_initalized);
25 g_shader_initalized = false;
26 } 22 }
27 23
28 bool InitializeShaderTranslator() { 24 bool InitializeShaderTranslator() {
29 if (!g_shader_initalized) { 25 static bool initialized = false;
26 if (!initialized) {
30 TRACE_EVENT0("gpu", "ShInitialize"); 27 TRACE_EVENT0("gpu", "ShInitialize");
31 CHECK(ShInitialize()); 28 CHECK(ShInitialize());
32 base::AtExitManager::RegisterCallback(&FinalizeShaderTranslator, NULL); 29 base::AtExitManager::RegisterCallback(&FinalizeShaderTranslator, NULL);
33 g_shader_initalized = true; 30 initialized = true;
34 } 31 }
35 return g_shader_initalized; 32 return initialized;
36 } 33 }
37 34
38 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 35 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108
39 typedef int ANGLEGetInfoType; 36 typedef int ANGLEGetInfoType;
40 #else 37 #else
41 typedef size_t ANGLEGetInfoType; 38 typedef size_t ANGLEGetInfoType;
42 #endif 39 #endif
43 40
44 void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type, 41 void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type,
45 ShaderTranslator::VariableMap* var_map) { 42 ShaderTranslator::VariableMap* var_map) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 translated_shader_.reset(); 307 translated_shader_.reset();
311 info_log_.reset(); 308 info_log_.reset();
312 attrib_map_.clear(); 309 attrib_map_.clear();
313 uniform_map_.clear(); 310 uniform_map_.clear();
314 name_map_.clear(); 311 name_map_.clear();
315 } 312 }
316 313
317 } // namespace gles2 314 } // namespace gles2
318 } // namespace gpu 315 } // namespace gpu
319 316
OLDNEW
« no previous file with comments | « trunk/src/crypto/nss_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698