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 13 matching lines...) Expand all Loading... | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/dom/DocumentLifecycle.h" | 32 #include "core/dom/DocumentLifecycle.h" |
33 | 33 |
34 #include "platform/RuntimeEnabledFeatures.h" | |
34 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0; | 39 static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0; |
39 | 40 |
40 DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState) | 41 DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState) |
41 : m_lifecycle(lifecycle) | 42 : m_lifecycle(lifecycle) |
42 , m_finalState(finalState) | 43 , m_finalState(finalState) |
43 { | 44 { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 break; | 188 break; |
188 case InPaintInvalidation: | 189 case InPaintInvalidation: |
189 return state == PaintInvalidationClean; | 190 return state == PaintInvalidationClean; |
190 case PaintInvalidationClean: | 191 case PaintInvalidationClean: |
191 if (state == InStyleRecalc) | 192 if (state == InStyleRecalc) |
192 return true; | 193 return true; |
193 if (state == InPreLayout) | 194 if (state == InPreLayout) |
194 return true; | 195 return true; |
195 if (state == InCompositingUpdate) | 196 if (state == InCompositingUpdate) |
196 return true; | 197 return true; |
198 if (state == InPaintForSlimmingPaintV2 && RuntimeEnabledFeatures::slimmi ngPaintV2Enabled()) | |
199 return true; | |
200 break; | |
201 case InPaintForSlimmingPaintV2: | |
202 if (state == PaintForSlimmingPaintV2Clean && RuntimeEnabledFeatures::sli mmingPaintV2Enabled()) | |
203 return true; | |
204 break; | |
205 case PaintForSlimmingPaintV2Clean: | |
206 if (state == InCompositingForSlimmingPaintV2 && RuntimeEnabledFeatures:: slimmingPaintV2Enabled()) | |
207 return true; | |
208 break; | |
209 case InCompositingForSlimmingPaintV2: | |
210 if (state == CompositingForSlimmingPaintV2Clean && RuntimeEnabledFeature s::slimmingPaintV2Enabled()) | |
211 return true; | |
212 break; | |
213 case CompositingForSlimmingPaintV2Clean: | |
214 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
215 return false; | |
216 if (state == InCompositingUpdate) | |
217 return true; | |
218 if (state == CompositingForSlimmingPaintV2Clean) | |
219 return true; | |
197 break; | 220 break; |
198 case Stopping: | 221 case Stopping: |
199 return state == Stopped; | 222 return state == Stopped; |
200 case Stopped: | 223 case Stopped: |
201 return state == Disposed; | 224 return state == Disposed; |
202 case Disposed: | 225 case Disposed: |
203 // FIXME: We can dispose a document multiple times. This seems wrong. | 226 // FIXME: We can dispose a document multiple times. This seems wrong. |
204 // See https://code.google.com/p/chromium/issues/detail?id=301668. | 227 // See https://code.google.com/p/chromium/issues/detail?id=301668. |
205 return state == Disposed; | 228 return state == Disposed; |
206 } | 229 } |
207 return false; | 230 return false; |
208 } | 231 } |
209 | 232 |
210 bool DocumentLifecycle::canRewindTo(State state) const | 233 bool DocumentLifecycle::canRewindTo(State state) const |
211 { | 234 { |
212 // This transition is bogus, but we've whitelisted it anyway. | 235 // This transition is bogus, but we've whitelisted it anyway. |
213 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f rom() && state == s_deprecatedTransitionStack->to()) | 236 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f rom() && state == s_deprecatedTransitionStack->to()) |
214 return true; | 237 return true; |
215 return m_state == StyleClean || m_state == LayoutSubtreeChangeClean || m_sta te == AfterPerformLayout || m_state == LayoutClean || m_state == CompositingClea n || m_state == PaintInvalidationClean; | 238 return m_state == StyleClean |
239 || m_state == LayoutSubtreeChangeClean | |
240 || m_state == AfterPerformLayout | |
241 || m_state == LayoutClean | |
242 || m_state == CompositingClean | |
243 || m_state == PaintInvalidationClean | |
244 || (m_state == CompositingForSlimmingPaintV2Clean && RuntimeEnabledFeatu res::slimmingPaintV2Enabled()); | |
chrishtr
2015/08/13 21:33:16
Also include CompositingForSlimmingPaintV2Clean.
pdr.
2015/08/14 00:10:29
Done
| |
216 } | 245 } |
217 | 246 |
218 #endif | 247 #endif |
219 | 248 |
220 void DocumentLifecycle::advanceTo(State state) | 249 void DocumentLifecycle::advanceTo(State state) |
221 { | 250 { |
222 ASSERT(canAdvanceTo(state)); | 251 ASSERT(canAdvanceTo(state)); |
223 m_state = state; | 252 m_state = state; |
224 } | 253 } |
225 | 254 |
226 void DocumentLifecycle::ensureStateAtMost(State state) | 255 void DocumentLifecycle::ensureStateAtMost(State state) |
227 { | 256 { |
228 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou tClean); | 257 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou tClean); |
229 if (m_state <= state) | 258 if (m_state <= state) |
230 return; | 259 return; |
231 ASSERT(canRewindTo(state)); | 260 ASSERT(canRewindTo(state)); |
232 m_state = state; | 261 m_state = state; |
233 } | 262 } |
234 | 263 |
235 } | 264 } |
OLD | NEW |