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-2010 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 | #include "compiler/intermediate.h" |
michael@0 | 8 | #include "compiler/RemoveTree.h" |
michael@0 | 9 | |
michael@0 | 10 | // |
michael@0 | 11 | // Code to recursively delete the intermediate tree. |
michael@0 | 12 | // |
michael@0 | 13 | |
michael@0 | 14 | class RemoveTree : public TIntermTraverser |
michael@0 | 15 | { |
michael@0 | 16 | public: |
michael@0 | 17 | RemoveTree() : TIntermTraverser(false, false, true) |
michael@0 | 18 | { |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | protected: |
michael@0 | 22 | void visitSymbol(TIntermSymbol*); |
michael@0 | 23 | void visitConstantUnion(TIntermConstantUnion*); |
michael@0 | 24 | bool visitBinary(Visit visit, TIntermBinary*); |
michael@0 | 25 | bool visitUnary(Visit visit, TIntermUnary*); |
michael@0 | 26 | bool visitSelection(Visit visit, TIntermSelection*); |
michael@0 | 27 | bool visitAggregate(Visit visit, TIntermAggregate*); |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | void RemoveTree::visitSymbol(TIntermSymbol* node) |
michael@0 | 31 | { |
michael@0 | 32 | delete node; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node) |
michael@0 | 36 | { |
michael@0 | 37 | delete node; |
michael@0 | 38 | |
michael@0 | 39 | return true; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node) |
michael@0 | 43 | { |
michael@0 | 44 | delete node; |
michael@0 | 45 | |
michael@0 | 46 | return true; |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node) |
michael@0 | 50 | { |
michael@0 | 51 | delete node; |
michael@0 | 52 | |
michael@0 | 53 | return true; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node) |
michael@0 | 57 | { |
michael@0 | 58 | delete node; |
michael@0 | 59 | |
michael@0 | 60 | return true; |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | void RemoveTree::visitConstantUnion(TIntermConstantUnion* node) |
michael@0 | 64 | { |
michael@0 | 65 | delete node; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | // |
michael@0 | 69 | // Entry point. |
michael@0 | 70 | // |
michael@0 | 71 | void RemoveAllTreeNodes(TIntermNode* root) |
michael@0 | 72 | { |
michael@0 | 73 | RemoveTree it; |
michael@0 | 74 | |
michael@0 | 75 | root->traverse(&it); |
michael@0 | 76 | } |
michael@0 | 77 |