gfx/angle/src/compiler/depgraph/DependencyGraph.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 //
michael@0 2 // Copyright (c) 2012 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 #pragma warning(disable: 4718)
michael@0 8
michael@0 9 #include "compiler/depgraph/DependencyGraph.h"
michael@0 10 #include "compiler/depgraph/DependencyGraphBuilder.h"
michael@0 11
michael@0 12 TDependencyGraph::TDependencyGraph(TIntermNode* intermNode)
michael@0 13 {
michael@0 14 TDependencyGraphBuilder::build(intermNode, this);
michael@0 15 }
michael@0 16
michael@0 17 TDependencyGraph::~TDependencyGraph()
michael@0 18 {
michael@0 19 for (TGraphNodeVector::const_iterator iter = mAllNodes.begin(); iter != mAllNodes.end(); ++iter)
michael@0 20 {
michael@0 21 TGraphNode* node = *iter;
michael@0 22 delete node;
michael@0 23 }
michael@0 24 }
michael@0 25
michael@0 26 TGraphArgument* TDependencyGraph::createArgument(TIntermAggregate* intermFunctionCall,
michael@0 27 int argumentNumber)
michael@0 28 {
michael@0 29 TGraphArgument* argument = new TGraphArgument(intermFunctionCall, argumentNumber);
michael@0 30 mAllNodes.push_back(argument);
michael@0 31 return argument;
michael@0 32 }
michael@0 33
michael@0 34 TGraphFunctionCall* TDependencyGraph::createFunctionCall(TIntermAggregate* intermFunctionCall)
michael@0 35 {
michael@0 36 TGraphFunctionCall* functionCall = new TGraphFunctionCall(intermFunctionCall);
michael@0 37 mAllNodes.push_back(functionCall);
michael@0 38 if (functionCall->getIntermFunctionCall()->isUserDefined())
michael@0 39 mUserDefinedFunctionCalls.push_back(functionCall);
michael@0 40 return functionCall;
michael@0 41 }
michael@0 42
michael@0 43 TGraphSymbol* TDependencyGraph::getOrCreateSymbol(TIntermSymbol* intermSymbol)
michael@0 44 {
michael@0 45 TSymbolIdMap::const_iterator iter = mSymbolIdMap.find(intermSymbol->getId());
michael@0 46
michael@0 47 TGraphSymbol* symbol = NULL;
michael@0 48
michael@0 49 if (iter != mSymbolIdMap.end()) {
michael@0 50 TSymbolIdPair pair = *iter;
michael@0 51 symbol = pair.second;
michael@0 52 } else {
michael@0 53 symbol = new TGraphSymbol(intermSymbol);
michael@0 54 mAllNodes.push_back(symbol);
michael@0 55
michael@0 56 TSymbolIdPair pair(intermSymbol->getId(), symbol);
michael@0 57 mSymbolIdMap.insert(pair);
michael@0 58
michael@0 59 // We save all sampler symbols in a collection, so we can start graph traversals from them quickly.
michael@0 60 if (IsSampler(intermSymbol->getBasicType()))
michael@0 61 mSamplerSymbols.push_back(symbol);
michael@0 62 }
michael@0 63
michael@0 64 return symbol;
michael@0 65 }
michael@0 66
michael@0 67 TGraphSelection* TDependencyGraph::createSelection(TIntermSelection* intermSelection)
michael@0 68 {
michael@0 69 TGraphSelection* selection = new TGraphSelection(intermSelection);
michael@0 70 mAllNodes.push_back(selection);
michael@0 71 return selection;
michael@0 72 }
michael@0 73
michael@0 74 TGraphLoop* TDependencyGraph::createLoop(TIntermLoop* intermLoop)
michael@0 75 {
michael@0 76 TGraphLoop* loop = new TGraphLoop(intermLoop);
michael@0 77 mAllNodes.push_back(loop);
michael@0 78 return loop;
michael@0 79 }
michael@0 80
michael@0 81 TGraphLogicalOp* TDependencyGraph::createLogicalOp(TIntermBinary* intermLogicalOp)
michael@0 82 {
michael@0 83 TGraphLogicalOp* logicalOp = new TGraphLogicalOp(intermLogicalOp);
michael@0 84 mAllNodes.push_back(logicalOp);
michael@0 85 return logicalOp;
michael@0 86 }
michael@0 87
michael@0 88 const char* TGraphLogicalOp::getOpString() const
michael@0 89 {
michael@0 90 const char* opString = NULL;
michael@0 91 switch (getIntermLogicalOp()->getOp()) {
michael@0 92 case EOpLogicalAnd: opString = "and"; break;
michael@0 93 case EOpLogicalOr: opString = "or"; break;
michael@0 94 default: opString = "unknown"; break;
michael@0 95 }
michael@0 96 return opString;
michael@0 97 }

mercurial