Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsForwardReference_h__ |
michael@0 | 7 | #define nsForwardReference_h__ |
michael@0 | 8 | |
michael@0 | 9 | class nsForwardReference |
michael@0 | 10 | { |
michael@0 | 11 | protected: |
michael@0 | 12 | nsForwardReference() {} |
michael@0 | 13 | |
michael@0 | 14 | public: |
michael@0 | 15 | virtual ~nsForwardReference() {} |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * Priority codes returned from GetPhase() |
michael@0 | 19 | */ |
michael@0 | 20 | enum Phase { |
michael@0 | 21 | /** A dummy marker, used to indicate unstarted resolution */ |
michael@0 | 22 | eStart, |
michael@0 | 23 | |
michael@0 | 24 | /** The initial pass, after which the content model will be |
michael@0 | 25 | fully built */ |
michael@0 | 26 | eConstruction, |
michael@0 | 27 | |
michael@0 | 28 | /** A second pass, after which all 'magic attribute' hookup |
michael@0 | 29 | will have been performed */ |
michael@0 | 30 | eHookup, |
michael@0 | 31 | |
michael@0 | 32 | /** A dummy marker, used in kPasses to indicate termination */ |
michael@0 | 33 | eDone |
michael@0 | 34 | }; |
michael@0 | 35 | |
michael@0 | 36 | /** |
michael@0 | 37 | * Forward references are categorized by 'priority', and all |
michael@0 | 38 | * forward references in a higher priority are resolved before any |
michael@0 | 39 | * reference in a lower priority. This variable specifies this |
michael@0 | 40 | * ordering. The last Priority is guaranteed to be eDone. |
michael@0 | 41 | */ |
michael@0 | 42 | static const Phase kPasses[]; |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * Get the state in which the forward reference should be resolved. |
michael@0 | 46 | * 'eConstruction' references are all resolved before 'eHookup' references |
michael@0 | 47 | * are resolved. |
michael@0 | 48 | * |
michael@0 | 49 | * @return the Phase in which the reference needs to be resolved |
michael@0 | 50 | */ |
michael@0 | 51 | virtual Phase GetPhase() = 0; |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Result codes returned from Resolve() |
michael@0 | 55 | */ |
michael@0 | 56 | enum Result { |
michael@0 | 57 | /** Resolution succeeded, I'm done. */ |
michael@0 | 58 | eResolve_Succeeded, |
michael@0 | 59 | |
michael@0 | 60 | /** Couldn't resolve, but try me later. */ |
michael@0 | 61 | eResolve_Later, |
michael@0 | 62 | |
michael@0 | 63 | /** Something bad happened, don't try again. */ |
michael@0 | 64 | eResolve_Error |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * Attempt to resolve the forward reference. |
michael@0 | 69 | * |
michael@0 | 70 | * @return a Result that tells the resolver how to treat |
michael@0 | 71 | * the reference. |
michael@0 | 72 | */ |
michael@0 | 73 | virtual Result Resolve() = 0; |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | #endif // nsForwardReference_h__ |