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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 // We can synchronously perform layout. | 136 // We can synchronously perform layout. |
| 137 if (nextState == InPreLayout) | 137 if (nextState == InPreLayout) |
| 138 return true; | 138 return true; |
| 139 if (nextState == InPerformLayout) | 139 if (nextState == InPerformLayout) |
| 140 return true; | 140 return true; |
| 141 // We can redundant arrive in the style clean state. | 141 // We can redundant arrive in the style clean state. |
| 142 if (nextState == StyleClean) | 142 if (nextState == StyleClean) |
| 143 return true; | 143 return true; |
| 144 if (nextState == LayoutClean) | 144 if (nextState == LayoutClean) |
| 145 return true; | 145 return true; |
| 146 if (nextState == InCompositingUpdate) | 146 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == In CompositingUpdate) |
| 147 return true; | |
| 148 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == InP rePaint) | |
| 147 return true; | 149 return true; |
| 148 break; | 150 break; |
| 149 case InLayoutSubtreeChange: | 151 case InLayoutSubtreeChange: |
| 150 return nextState == LayoutSubtreeChangeClean; | 152 return nextState == LayoutSubtreeChangeClean; |
| 151 case LayoutSubtreeChangeClean: | 153 case LayoutSubtreeChangeClean: |
| 152 // We can synchronously recalc style. | 154 // We can synchronously recalc style. |
| 153 if (nextState == InStyleRecalc) | 155 if (nextState == InStyleRecalc) |
| 154 return true; | 156 return true; |
| 155 // We can synchronously perform layout. | 157 // We can synchronously perform layout. |
| 156 if (nextState == InPreLayout) | 158 if (nextState == InPreLayout) |
| 157 return true; | 159 return true; |
| 158 if (nextState == InPerformLayout) | 160 if (nextState == InPerformLayout) |
| 159 return true; | 161 return true; |
| 160 // Can move back to style clean. | 162 // Can move back to style clean. |
| 161 if (nextState == StyleClean) | 163 if (nextState == StyleClean) |
| 162 return true; | 164 return true; |
| 163 if (nextState == LayoutClean) | 165 if (nextState == LayoutClean) |
| 164 return true; | 166 return true; |
| 165 if (nextState == InCompositingUpdate) | 167 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == In CompositingUpdate) |
| 168 return true; | |
| 169 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == InP rePaint) | |
| 166 return true; | 170 return true; |
| 167 break; | 171 break; |
| 168 case InPreLayout: | 172 case InPreLayout: |
| 169 if (nextState == InStyleRecalc) | 173 if (nextState == InStyleRecalc) |
| 170 return true; | 174 return true; |
| 171 if (nextState == StyleClean) | 175 if (nextState == StyleClean) |
| 172 return true; | 176 return true; |
| 173 if (nextState == InPreLayout) | 177 if (nextState == InPreLayout) |
| 174 return true; | 178 return true; |
| 175 break; | 179 break; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 191 if (nextState == InPreLayout) | 195 if (nextState == InPreLayout) |
| 192 return true; | 196 return true; |
| 193 if (nextState == InPerformLayout) | 197 if (nextState == InPerformLayout) |
| 194 return true; | 198 return true; |
| 195 // We can redundantly arrive in the layout clean state. This situation | 199 // We can redundantly arrive in the layout clean state. This situation |
| 196 // can happen when we call layout recursively and we unwind the stack. | 200 // can happen when we call layout recursively and we unwind the stack. |
| 197 if (nextState == LayoutClean) | 201 if (nextState == LayoutClean) |
| 198 return true; | 202 return true; |
| 199 if (nextState == StyleClean) | 203 if (nextState == StyleClean) |
| 200 return true; | 204 return true; |
| 201 if (nextState == InCompositingUpdate) | 205 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == In CompositingUpdate) |
| 206 return true; | |
| 207 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == InP rePaint) | |
| 202 return true; | 208 return true; |
| 203 break; | 209 break; |
| 204 case InCompositingUpdate: | 210 case InCompositingUpdate: |
| 211 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | |
|
Xianzhu
2016/09/14 00:35:53
We still need CompositingUpdate for slimmingPaintI
chrishtr
2016/09/14 19:43:24
Fixed.
| |
| 205 return nextState == CompositingClean; | 212 return nextState == CompositingClean; |
| 206 case CompositingClean: | 213 case CompositingClean: |
| 214 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | |
|
Xianzhu
2016/09/14 00:35:53
Ditto.
chrishtr
2016/09/14 19:43:24
Fixed.
| |
| 207 if (nextState == InStyleRecalc) | 215 if (nextState == InStyleRecalc) |
| 208 return true; | 216 return true; |
| 209 if (nextState == InPreLayout) | 217 if (nextState == InPreLayout) |
| 210 return true; | 218 return true; |
| 211 if (nextState == InCompositingUpdate) | 219 if (nextState == InCompositingUpdate) |
| 212 return true; | 220 return true; |
| 213 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | 221 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
| 214 if (nextState == InPrePaint) | 222 if (nextState == InPrePaint) |
| 215 return true; | 223 return true; |
| 216 } else if (nextState == InPaintInvalidation) { | 224 } else if (nextState == InPaintInvalidation) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 237 break; | 245 break; |
| 238 case PrePaintClean: | 246 case PrePaintClean: |
| 239 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 247 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 240 break; | 248 break; |
| 241 if (nextState == InPaint) | 249 if (nextState == InPaint) |
| 242 return true; | 250 return true; |
| 243 if (nextState == InStyleRecalc) | 251 if (nextState == InStyleRecalc) |
| 244 return true; | 252 return true; |
| 245 if (nextState == InPreLayout) | 253 if (nextState == InPreLayout) |
| 246 return true; | 254 return true; |
| 247 if (nextState == InCompositingUpdate) | 255 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == In CompositingUpdate) |
| 256 return true; | |
| 257 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == InP rePaint) | |
| 248 return true; | 258 return true; |
| 249 break; | 259 break; |
| 250 case InPaint: | 260 case InPaint: |
| 251 if (nextState == PaintClean) | 261 if (nextState == PaintClean) |
| 252 return true; | 262 return true; |
| 253 break; | 263 break; |
| 254 case PaintClean: | 264 case PaintClean: |
| 255 if (nextState == InStyleRecalc) | 265 if (nextState == InStyleRecalc) |
| 256 return true; | 266 return true; |
| 257 if (nextState == InPreLayout) | 267 if (nextState == InPreLayout) |
| 258 return true; | 268 return true; |
| 259 if (nextState == InCompositingUpdate) | 269 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == In CompositingUpdate) |
| 270 return true; | |
| 271 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && nextState == InP rePaint) | |
| 260 return true; | 272 return true; |
| 261 break; | 273 break; |
| 262 case Stopping: | 274 case Stopping: |
| 263 return nextState == Stopped; | 275 return nextState == Stopped; |
| 264 case Stopped: | 276 case Stopped: |
| 265 return false; | 277 return false; |
| 266 } | 278 } |
| 267 return false; | 279 return false; |
| 268 } | 280 } |
| 269 | 281 |
| 270 bool DocumentLifecycle::canRewindTo(LifecycleState nextState) const | 282 bool DocumentLifecycle::canRewindTo(LifecycleState nextState) const |
| 271 { | 283 { |
| 272 if (stateTransitionDisallowed()) | 284 if (stateTransitionDisallowed()) |
| 273 return false; | 285 return false; |
| 274 | 286 |
| 275 // This transition is bogus, but we've whitelisted it anyway. | 287 // This transition is bogus, but we've whitelisted it anyway. |
| 276 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f rom() && nextState == s_deprecatedTransitionStack->to()) | 288 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f rom() && nextState == s_deprecatedTransitionStack->to()) |
| 277 return true; | 289 return true; |
| 278 return m_state == StyleClean | 290 return m_state == StyleClean |
| 279 || m_state == LayoutSubtreeChangeClean | 291 || m_state == LayoutSubtreeChangeClean |
| 280 || m_state == AfterPerformLayout | 292 || m_state == AfterPerformLayout |
| 281 || m_state == LayoutClean | 293 || m_state == LayoutClean |
| 282 || m_state == CompositingClean | 294 || m_state == CompositingClean |
| 283 || m_state == PaintInvalidationClean | 295 || m_state == PaintInvalidationClean |
| 284 || m_state == PaintClean; | 296 || m_state == PaintClean |
| 297 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_state == PrePa intClean); | |
| 285 } | 298 } |
| 286 | 299 |
| 287 #endif | 300 #endif |
| 288 | 301 |
| 289 void DocumentLifecycle::advanceTo(LifecycleState nextState) | 302 void DocumentLifecycle::advanceTo(LifecycleState nextState) |
| 290 { | 303 { |
| 291 #if DCHECK_IS_ON() | 304 #if DCHECK_IS_ON() |
| 292 DCHECK(canAdvanceTo(nextState)) | 305 DCHECK(canAdvanceTo(nextState)) |
| 293 << "Cannot advance document lifecycle from " << stateAsDebugString(m_sta te) | 306 << "Cannot advance document lifecycle from " << stateAsDebugString(m_sta te) |
| 294 << " to " << stateAsDebugString(nextState) << "."; | 307 << " to " << stateAsDebugString(nextState) << "."; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 DEBUG_STRING_CASE(Stopping); | 356 DEBUG_STRING_CASE(Stopping); |
| 344 DEBUG_STRING_CASE(Stopped); | 357 DEBUG_STRING_CASE(Stopped); |
| 345 } | 358 } |
| 346 | 359 |
| 347 ASSERT_NOT_REACHED(); | 360 ASSERT_NOT_REACHED(); |
| 348 return "Unknown"; | 361 return "Unknown"; |
| 349 } | 362 } |
| 350 #endif | 363 #endif |
| 351 | 364 |
| 352 } // namespace blink | 365 } // namespace blink |
| OLD | NEW |