Refactor platform related functionality into platform.h and tls.h.

Since libGLESv2 and libEGL will eventually be cross platform, it will be
useful to have platform defines and TLS functions that work everywhere.

BUG=angle:664

Change-Id: Ia357925a0992d82e8b446d88d32a1984d319e6e8
Reviewed-on: https://chromium-review.googlesource.com/202133
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/PoolAlloc.cpp b/src/compiler/translator/PoolAlloc.cpp
index abe7026..887cb66 100644
--- a/src/compiler/translator/PoolAlloc.cpp
+++ b/src/compiler/translator/PoolAlloc.cpp
@@ -6,43 +6,44 @@
 
 #include "compiler/translator/PoolAlloc.h"
 
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-#include <stdio.h>
-
-#include "common/angleutils.h"
 #include "compiler/translator/InitializeGlobals.h"
-#include "compiler/translator/osinclude.h"
 
-OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
+#include "common/platform.h"
+#include "common/angleutils.h"
+#include "common/tls.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <assert.h>
+
+TLSIndex PoolIndex = TLS_INVALID_INDEX;
 
 bool InitializePoolIndex()
 {
-    assert(PoolIndex == OS_INVALID_TLS_INDEX);
+    assert(PoolIndex == TLS_INVALID_INDEX);
 
-    PoolIndex = OS_AllocTLSIndex();
-    return PoolIndex != OS_INVALID_TLS_INDEX;
+    PoolIndex = CreateTLSIndex();
+    return PoolIndex != TLS_INVALID_INDEX;
 }
 
 void FreePoolIndex()
 {
-    assert(PoolIndex != OS_INVALID_TLS_INDEX);
+    assert(PoolIndex != TLS_INVALID_INDEX);
 
-    OS_FreeTLSIndex(PoolIndex);
-    PoolIndex = OS_INVALID_TLS_INDEX;
+    DestroyTLSIndex(PoolIndex);
+    PoolIndex = TLS_INVALID_INDEX;
 }
 
 TPoolAllocator* GetGlobalPoolAllocator()
 {
-    assert(PoolIndex != OS_INVALID_TLS_INDEX);
-    return static_cast<TPoolAllocator*>(OS_GetTLSValue(PoolIndex));
+    assert(PoolIndex != TLS_INVALID_INDEX);
+    return static_cast<TPoolAllocator*>(GetTLSValue(PoolIndex));
 }
 
 void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator)
 {
-    assert(PoolIndex != OS_INVALID_TLS_INDEX);
-    OS_SetTLSValue(PoolIndex, poolAllocator);
+    assert(PoolIndex != TLS_INVALID_INDEX);
+    SetTLSValue(PoolIndex, poolAllocator);
 }
 
 //