Fixed memory leak associated with TLS.
We used to allocate thread-local memory on each compile.
If the compile did not happen on the same thread as ShInitialize,
we leaked the thread-local memory.
It turns out that there is no need to allocate any thread-local
memory. This patch cleans up all the unnecessary junk around TLS.
BUG=crbug.com/181691
R=kbr@chromium.org
Review URL: https://codereview.appspot.com/11679046
Conflicts:
src/compiler/ConstantUnion.h
src/compiler/ShaderLang.cpp
src/compiler/Types.h
src/compiler/ValidateLimitations.cpp
diff --git a/src/compiler/ShaderLang.cpp b/src/compiler/ShaderLang.cpp
index 48dc0a0..1551dad 100644
--- a/src/compiler/ShaderLang.cpp
+++ b/src/compiler/ShaderLang.cpp
@@ -99,9 +99,7 @@
//
int ShFinalize()
{
- if (!DetachProcess())
- return 0;
-
+ DetachProcess();
return 1;
}
@@ -149,9 +147,6 @@
ShShaderOutput output,
const ShBuiltInResources* resources)
{
- if (!InitThread())
- return 0;
-
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec, output));
TCompiler* compiler = base->getAsCompiler();
if (compiler == 0)
@@ -190,9 +185,6 @@
size_t numStrings,
int compileOptions)
{
- if (!InitThread())
- return 0;
-
if (handle == 0)
return 0;