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 nextState == PaintInvalidationClean; | 190 return nextState == PaintInvalidationClean; |
190 case PaintInvalidationClean: | 191 case PaintInvalidationClean: |
191 if (nextState == InStyleRecalc) | 192 if (nextState == InStyleRecalc) |
192 return true; | 193 return true; |
193 if (nextState == InPreLayout) | 194 if (nextState == InPreLayout) |
194 return true; | 195 return true; |
195 if (nextState == InCompositingUpdate) | 196 if (nextState == InCompositingUpdate) |
196 return true; | 197 return true; |
| 198 if (nextState == InPaintForSlimmingPaintV2 && RuntimeEnabledFeatures::sl
immingPaintV2Enabled()) |
| 199 return true; |
| 200 break; |
| 201 case InPaintForSlimmingPaintV2: |
| 202 if (nextState == PaintForSlimmingPaintV2Clean && RuntimeEnabledFeatures:
:slimmingPaintV2Enabled()) |
| 203 return true; |
| 204 break; |
| 205 case PaintForSlimmingPaintV2Clean: |
| 206 if (nextState == InCompositingForSlimmingPaintV2 && RuntimeEnabledFeatur
es::slimmingPaintV2Enabled()) |
| 207 return true; |
| 208 break; |
| 209 case InCompositingForSlimmingPaintV2: |
| 210 if (nextState == CompositingForSlimmingPaintV2Clean && RuntimeEnabledFea
tures::slimmingPaintV2Enabled()) |
| 211 return true; |
| 212 break; |
| 213 case CompositingForSlimmingPaintV2Clean: |
| 214 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 215 return false; |
| 216 if (nextState == InCompositingUpdate) |
| 217 return true; |
| 218 if (nextState == CompositingForSlimmingPaintV2Clean) |
| 219 return true; |
197 break; | 220 break; |
198 case Stopping: | 221 case Stopping: |
199 return nextState == Stopped; | 222 return nextState == Stopped; |
200 case Stopped: | 223 case Stopped: |
201 return nextState == Disposed; | 224 return nextState == 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 nextState == Disposed; | 228 return nextState == Disposed; |
206 } | 229 } |
207 return false; | 230 return false; |
208 } | 231 } |
209 | 232 |
210 bool DocumentLifecycle::canRewindTo(State nextState) const | 233 bool DocumentLifecycle::canRewindTo(State nextState) 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() && nextState == s_deprecatedTransitionStack->to()) | 236 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f
rom() && nextState == 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 == PaintForSlimmingPaintV2Clean && RuntimeEnabledFeatures::s
limmingPaintV2Enabled()) |
| 245 || (m_state == CompositingForSlimmingPaintV2Clean && RuntimeEnabledFeatu
res::slimmingPaintV2Enabled()); |
216 } | 246 } |
217 | 247 |
218 #endif | 248 #endif |
219 | 249 |
220 void DocumentLifecycle::advanceTo(State nextState) | 250 void DocumentLifecycle::advanceTo(State nextState) |
221 { | 251 { |
222 ASSERT(canAdvanceTo(nextState)); | 252 ASSERT(canAdvanceTo(nextState)); |
223 m_state = nextState; | 253 m_state = nextState; |
224 } | 254 } |
225 | 255 |
226 void DocumentLifecycle::ensureStateAtMost(State state) | 256 void DocumentLifecycle::ensureStateAtMost(State state) |
227 { | 257 { |
228 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou
tClean); | 258 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou
tClean); |
229 if (m_state <= state) | 259 if (m_state <= state) |
230 return; | 260 return; |
231 ASSERT(canRewindTo(state)); | 261 ASSERT(canRewindTo(state)); |
232 m_state = state; | 262 m_state = state; |
233 } | 263 } |
234 | 264 |
235 } | 265 } |
OLD | NEW |