blob: 89901935ca3e7468c4803a594a92ac7c242233d7 [file] [log] [blame]
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
Dmitry Skiba01971112015-07-10 14:54:00 -04007#include "compiler/translator/Cache.h"
Geoff Lang17732822013-08-29 13:46:49 -04008#include "compiler/translator/InitializeDll.h"
Geoff Lang17732822013-08-29 13:46:49 -04009#include "compiler/translator/InitializeGlobals.h"
10#include "compiler/translator/InitializeParseContext.h"
Geoff Lang44fa7592014-05-30 11:50:07 -040011
12#include "common/platform.h"
13
14#include <assert.h>
daniel@transgaming.combbf56f72010-04-20 18:52:13 +000015
Jamie Madill45bcc782016-11-07 13:58:48 -050016namespace sh
17{
18
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000019bool InitProcess()
20{
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000021 if (!InitializePoolIndex()) {
22 assert(0 && "InitProcess(): Failed to initalize global pool");
23 return false;
alokp@chromium.org34b99cd2010-07-27 18:37:55 +000024 }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000025
26 if (!InitializeParseContextIndex()) {
27 assert(0 && "InitProcess(): Failed to initalize parse context");
28 return false;
alokp@chromium.org34b99cd2010-07-27 18:37:55 +000029 }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000030
Dmitry Skiba01971112015-07-10 14:54:00 -040031 TCache::initialize();
32
alokp@chromium.org34b99cd2010-07-27 18:37:55 +000033 return true;
34}
35
Alok Priyadarshi8156b6b2013-09-23 14:56:58 -040036void DetachProcess()
alokp@chromium.org34b99cd2010-07-27 18:37:55 +000037{
Alok Priyadarshi8156b6b2013-09-23 14:56:58 -040038 FreeParseContextIndex();
39 FreePoolIndex();
Dmitry Skiba01971112015-07-10 14:54:00 -040040 TCache::destroy();
alokp@chromium.org34b99cd2010-07-27 18:37:55 +000041}
Jamie Madill45bcc782016-11-07 13:58:48 -050042
43} // namespace sh