Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 class DocumentLifecycle { | 38 class DocumentLifecycle { |
| 39 WTF_MAKE_NONCOPYABLE(DocumentLifecycle); | 39 WTF_MAKE_NONCOPYABLE(DocumentLifecycle); |
| 40 public: | 40 public: |
| 41 enum State { | 41 enum State { |
| 42 Uninitialized, | 42 Uninitialized, |
| 43 Inactive, | 43 Inactive, |
| 44 | 44 |
| 45 // When the document is active, it traverses these states. | 45 // When the document is active, it traverses these states. |
| 46 | 46 |
| 47 StyleRecalcPending, | 47 UpdatePending, |
|
ojan
2014/04/09 22:43:27
This name is a bit too general, e.g. InCompositing
| |
| 48 | |
| 48 InStyleRecalc, | 49 InStyleRecalc, |
| 49 StyleClean, | 50 StyleClean, |
| 50 | 51 |
| 51 InPreLayout, | 52 InPreLayout, |
| 52 InPerformLayout, | 53 InPerformLayout, |
| 53 AfterPerformLayout, | 54 AfterPerformLayout, |
| 54 LayoutClean, | 55 LayoutClean, |
| 55 | 56 |
| 56 InCompositingUpdate, | 57 InCompositingUpdate, |
| 57 CompositingClean, | 58 CompositingClean, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 | 94 |
| 94 DocumentLifecycle(); | 95 DocumentLifecycle(); |
| 95 ~DocumentLifecycle(); | 96 ~DocumentLifecycle(); |
| 96 | 97 |
| 97 bool isActive() const { return m_state > Inactive && m_state < Stopping; } | 98 bool isActive() const { return m_state > Inactive && m_state < Stopping; } |
| 98 State state() const { return m_state; } | 99 State state() const { return m_state; } |
| 99 | 100 |
| 100 bool stateAllowsTreeMutations() const; | 101 bool stateAllowsTreeMutations() const; |
| 101 | 102 |
| 102 void advanceTo(State); | 103 void advanceTo(State); |
| 103 void rewindTo(State); | 104 void ensureStateAtMost(State); |
| 104 | 105 |
| 105 private: | 106 private: |
| 106 #if !ASSERT_DISABLED | 107 #if !ASSERT_DISABLED |
| 107 bool canAdvanceTo(State) const; | 108 bool canAdvanceTo(State) const; |
| 109 bool canRewindTo(State) const; | |
| 108 #endif | 110 #endif |
| 109 | 111 |
| 110 State m_state; | 112 State m_state; |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 inline bool DocumentLifecycle::stateAllowsTreeMutations() const | 115 inline bool DocumentLifecycle::stateAllowsTreeMutations() const |
| 114 { | 116 { |
| 115 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout either, | 117 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout either, |
| 116 // but we need to fix MediaList listeners and plugins first. | 118 // but we need to fix MediaList listeners and plugins first. |
| 117 return m_state != InStyleRecalc | 119 return m_state != InStyleRecalc |
| 118 && m_state != InPerformLayout | 120 && m_state != InPerformLayout |
| 119 && m_state != InCompositingUpdate; | 121 && m_state != InCompositingUpdate; |
| 120 } | 122 } |
| 121 | 123 |
| 122 } | 124 } |
| 123 | 125 |
| 124 #endif | 126 #endif |
| OLD | NEW |