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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 ~DetachScope() | 128 ~DetachScope() |
129 { | 129 { |
130 m_documentLifecycle.decrementDetachCount(); | 130 m_documentLifecycle.decrementDetachCount(); |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 DocumentLifecycle& m_documentLifecycle; | 134 DocumentLifecycle& m_documentLifecycle; |
135 }; | 135 }; |
136 | 136 |
| 137 class PreventThrottlingScope { |
| 138 STACK_ALLOCATED(); |
| 139 WTF_MAKE_NONCOPYABLE(PreventThrottlingScope); |
| 140 public: |
| 141 PreventThrottlingScope(DocumentLifecycle&); |
| 142 ~PreventThrottlingScope(); |
| 143 }; |
| 144 |
137 DocumentLifecycle(); | 145 DocumentLifecycle(); |
138 ~DocumentLifecycle(); | 146 ~DocumentLifecycle(); |
139 | 147 |
140 bool isActive() const { return m_state > Inactive && m_state < Stopping; } | 148 bool isActive() const { return m_state > Inactive && m_state < Stopping; } |
141 State state() const { return m_state; } | 149 State state() const { return m_state; } |
142 | 150 |
143 bool stateAllowsTreeMutations() const; | 151 bool stateAllowsTreeMutations() const; |
144 bool stateAllowsLayoutTreeMutations() const; | 152 bool stateAllowsLayoutTreeMutations() const; |
145 bool stateAllowsDetach() const; | 153 bool stateAllowsDetach() const; |
146 bool stateAllowsLayoutInvalidation() const; | 154 bool stateAllowsLayoutInvalidation() const; |
147 bool stateAllowsLayoutTreeNotifications() const; | 155 bool stateAllowsLayoutTreeNotifications() const; |
148 | 156 |
149 void advanceTo(State); | 157 void advanceTo(State); |
150 void ensureStateAtMost(State); | 158 void ensureStateAtMost(State); |
151 | 159 |
152 bool inDetach() const { return m_detachCount; } | 160 bool inDetach() const { return m_detachCount; } |
153 void incrementDetachCount() { m_detachCount++; } | 161 void incrementDetachCount() { m_detachCount++; } |
154 void decrementDetachCount() | 162 void decrementDetachCount() |
155 { | 163 { |
156 ASSERT(m_detachCount > 0); | 164 ASSERT(m_detachCount > 0); |
157 m_detachCount--; | 165 m_detachCount--; |
158 } | 166 } |
159 | 167 |
| 168 bool throttlingAllowed() const; |
| 169 |
160 #if ENABLE(ASSERT) | 170 #if ENABLE(ASSERT) |
161 static const char* stateAsDebugString(const State); | 171 static const char* stateAsDebugString(const State); |
162 #endif | 172 #endif |
163 | 173 |
164 private: | 174 private: |
165 #if ENABLE(ASSERT) | 175 #if ENABLE(ASSERT) |
166 bool canAdvanceTo(State) const; | 176 bool canAdvanceTo(State) const; |
167 bool canRewindTo(State) const; | 177 bool canRewindTo(State) const; |
168 #endif | 178 #endif |
169 | 179 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 && m_state != InCompositingUpdate | 225 && m_state != InCompositingUpdate |
216 && m_state != InPaintInvalidation | 226 && m_state != InPaintInvalidation |
217 && m_state != InUpdatePaintProperties | 227 && m_state != InUpdatePaintProperties |
218 && m_state != InPaint | 228 && m_state != InPaint |
219 && m_state != InCompositingForSlimmingPaintV2; | 229 && m_state != InCompositingForSlimmingPaintV2; |
220 } | 230 } |
221 | 231 |
222 } // namespace blink | 232 } // namespace blink |
223 | 233 |
224 #endif | 234 #endif |
OLD | NEW |