Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | #ifndef CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_ |
michael@0 | 8 | #define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_ |
michael@0 | 9 | |
michael@0 | 10 | #include <set> |
michael@0 | 11 | |
michael@0 | 12 | #include "compiler/ForLoopUnroll.h" |
michael@0 | 13 | #include "compiler/intermediate.h" |
michael@0 | 14 | #include "compiler/ParseHelper.h" |
michael@0 | 15 | |
michael@0 | 16 | class TOutputGLSLBase : public TIntermTraverser |
michael@0 | 17 | { |
michael@0 | 18 | public: |
michael@0 | 19 | TOutputGLSLBase(TInfoSinkBase& objSink, |
michael@0 | 20 | ShArrayIndexClampingStrategy clampingStrategy, |
michael@0 | 21 | ShHashFunction64 hashFunction, |
michael@0 | 22 | NameMap& nameMap, |
michael@0 | 23 | TSymbolTable& symbolTable); |
michael@0 | 24 | |
michael@0 | 25 | protected: |
michael@0 | 26 | TInfoSinkBase& objSink() { return mObjSink; } |
michael@0 | 27 | void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr); |
michael@0 | 28 | void writeVariableType(const TType& type); |
michael@0 | 29 | virtual bool writeVariablePrecision(TPrecision precision) = 0; |
michael@0 | 30 | void writeFunctionParameters(const TIntermSequence& args); |
michael@0 | 31 | const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion); |
michael@0 | 32 | TString getTypeName(const TType& type); |
michael@0 | 33 | |
michael@0 | 34 | virtual void visitSymbol(TIntermSymbol* node); |
michael@0 | 35 | virtual void visitConstantUnion(TIntermConstantUnion* node); |
michael@0 | 36 | virtual bool visitBinary(Visit visit, TIntermBinary* node); |
michael@0 | 37 | virtual bool visitUnary(Visit visit, TIntermUnary* node); |
michael@0 | 38 | virtual bool visitSelection(Visit visit, TIntermSelection* node); |
michael@0 | 39 | virtual bool visitAggregate(Visit visit, TIntermAggregate* node); |
michael@0 | 40 | virtual bool visitLoop(Visit visit, TIntermLoop* node); |
michael@0 | 41 | virtual bool visitBranch(Visit visit, TIntermBranch* node); |
michael@0 | 42 | |
michael@0 | 43 | void visitCodeBlock(TIntermNode* node); |
michael@0 | 44 | |
michael@0 | 45 | |
michael@0 | 46 | // Return the original name if hash function pointer is NULL; |
michael@0 | 47 | // otherwise return the hashed name. |
michael@0 | 48 | TString hashName(const TString& name); |
michael@0 | 49 | // Same as hashName(), but without hashing built-in variables. |
michael@0 | 50 | TString hashVariableName(const TString& name); |
michael@0 | 51 | // Same as hashName(), but without hashing built-in functions. |
michael@0 | 52 | TString hashFunctionName(const TString& mangled_name); |
michael@0 | 53 | |
michael@0 | 54 | private: |
michael@0 | 55 | bool structDeclared(const TStructure* structure) const; |
michael@0 | 56 | void declareStruct(const TStructure* structure); |
michael@0 | 57 | |
michael@0 | 58 | TInfoSinkBase& mObjSink; |
michael@0 | 59 | bool mDeclaringVariables; |
michael@0 | 60 | |
michael@0 | 61 | // Structs are declared as the tree is traversed. This set contains all |
michael@0 | 62 | // the structs already declared. It is maintained so that a struct is |
michael@0 | 63 | // declared only once. |
michael@0 | 64 | typedef std::set<TString> DeclaredStructs; |
michael@0 | 65 | DeclaredStructs mDeclaredStructs; |
michael@0 | 66 | |
michael@0 | 67 | ForLoopUnroll mLoopUnroll; |
michael@0 | 68 | |
michael@0 | 69 | ShArrayIndexClampingStrategy mClampingStrategy; |
michael@0 | 70 | |
michael@0 | 71 | // name hashing. |
michael@0 | 72 | ShHashFunction64 mHashFunction; |
michael@0 | 73 | |
michael@0 | 74 | NameMap& mNameMap; |
michael@0 | 75 | |
michael@0 | 76 | TSymbolTable& mSymbolTable; |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | #endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_ |