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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return true; | 199 return true; |
200 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 200 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
201 next_state == kInCompositingUpdate) | 201 next_state == kInCompositingUpdate) |
202 return true; | 202 return true; |
203 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 203 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
204 next_state == kInPrePaint) | 204 next_state == kInPrePaint) |
205 return true; | 205 return true; |
206 break; | 206 break; |
207 case kInCompositingUpdate: | 207 case kInCompositingUpdate: |
208 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 208 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
209 return next_state == kCompositingClean; | 209 // Once we are in the compositing update, we can either just clean the |
| 210 // inputs or do the whole of compositing. |
| 211 return next_state == kCompositingInputsClean || |
| 212 next_state == kCompositingClean; |
| 213 case kCompositingInputsClean: |
| 214 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 215 // We can return to style re-calc, layout, or the start of compositing. |
| 216 if (next_state == kInStyleRecalc) |
| 217 return true; |
| 218 if (next_state == kInPreLayout) |
| 219 return true; |
| 220 if (next_state == kInCompositingUpdate) |
| 221 return true; |
| 222 // Otherwise, we can continue onwards. |
| 223 if (next_state == kCompositingClean) |
| 224 return true; |
210 case kCompositingClean: | 225 case kCompositingClean: |
211 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 226 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
212 if (next_state == kInStyleRecalc) | 227 if (next_state == kInStyleRecalc) |
213 return true; | 228 return true; |
214 if (next_state == kInPreLayout) | 229 if (next_state == kInPreLayout) |
215 return true; | 230 return true; |
216 if (next_state == kInCompositingUpdate) | 231 if (next_state == kInCompositingUpdate) |
217 return true; | 232 return true; |
218 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | 233 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
219 if (next_state == kInPrePaint) | 234 if (next_state == kInPrePaint) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 295 |
281 bool DocumentLifecycle::CanRewindTo(LifecycleState next_state) const { | 296 bool DocumentLifecycle::CanRewindTo(LifecycleState next_state) const { |
282 if (StateTransitionDisallowed()) | 297 if (StateTransitionDisallowed()) |
283 return false; | 298 return false; |
284 | 299 |
285 // This transition is bogus, but we've whitelisted it anyway. | 300 // This transition is bogus, but we've whitelisted it anyway. |
286 if (g_deprecated_transition_stack && | 301 if (g_deprecated_transition_stack && |
287 state_ == g_deprecated_transition_stack->From() && | 302 state_ == g_deprecated_transition_stack->From() && |
288 next_state == g_deprecated_transition_stack->To()) | 303 next_state == g_deprecated_transition_stack->To()) |
289 return true; | 304 return true; |
| 305 // TODO(smcgruer): Not sure if this is correct. |
290 return state_ == kStyleClean || state_ == kLayoutSubtreeChangeClean || | 306 return state_ == kStyleClean || state_ == kLayoutSubtreeChangeClean || |
291 state_ == kAfterPerformLayout || state_ == kLayoutClean || | 307 state_ == kAfterPerformLayout || state_ == kLayoutClean || |
292 state_ == kCompositingClean || state_ == kPaintInvalidationClean || | 308 state_ == kCompositingInputsClean || state_ == kCompositingClean || |
293 state_ == kPrePaintClean || state_ == kPaintClean; | 309 state_ == kPaintInvalidationClean || state_ == kPrePaintClean || |
| 310 state_ == kPaintClean; |
294 } | 311 } |
295 | 312 |
296 #define DEBUG_STRING_CASE(StateName) \ | 313 #define DEBUG_STRING_CASE(StateName) \ |
297 case DocumentLifecycle::StateName: \ | 314 case DocumentLifecycle::StateName: \ |
298 return #StateName | 315 return #StateName |
299 | 316 |
300 static WTF::String StateAsDebugString( | 317 static WTF::String StateAsDebugString( |
301 const DocumentLifecycle::LifecycleState& state) { | 318 const DocumentLifecycle::LifecycleState& state) { |
302 switch (state) { | 319 switch (state) { |
303 DEBUG_STRING_CASE(kUninitialized); | 320 DEBUG_STRING_CASE(kUninitialized); |
304 DEBUG_STRING_CASE(kInactive); | 321 DEBUG_STRING_CASE(kInactive); |
305 DEBUG_STRING_CASE(kVisualUpdatePending); | 322 DEBUG_STRING_CASE(kVisualUpdatePending); |
306 DEBUG_STRING_CASE(kInStyleRecalc); | 323 DEBUG_STRING_CASE(kInStyleRecalc); |
307 DEBUG_STRING_CASE(kStyleClean); | 324 DEBUG_STRING_CASE(kStyleClean); |
308 DEBUG_STRING_CASE(kInLayoutSubtreeChange); | 325 DEBUG_STRING_CASE(kInLayoutSubtreeChange); |
309 DEBUG_STRING_CASE(kLayoutSubtreeChangeClean); | 326 DEBUG_STRING_CASE(kLayoutSubtreeChangeClean); |
310 DEBUG_STRING_CASE(kInPreLayout); | 327 DEBUG_STRING_CASE(kInPreLayout); |
311 DEBUG_STRING_CASE(kInPerformLayout); | 328 DEBUG_STRING_CASE(kInPerformLayout); |
312 DEBUG_STRING_CASE(kAfterPerformLayout); | 329 DEBUG_STRING_CASE(kAfterPerformLayout); |
313 DEBUG_STRING_CASE(kLayoutClean); | 330 DEBUG_STRING_CASE(kLayoutClean); |
314 DEBUG_STRING_CASE(kInCompositingUpdate); | 331 DEBUG_STRING_CASE(kInCompositingUpdate); |
| 332 DEBUG_STRING_CASE(kCompositingInputsClean); |
315 DEBUG_STRING_CASE(kCompositingClean); | 333 DEBUG_STRING_CASE(kCompositingClean); |
316 DEBUG_STRING_CASE(kInPaintInvalidation); | 334 DEBUG_STRING_CASE(kInPaintInvalidation); |
317 DEBUG_STRING_CASE(kPaintInvalidationClean); | 335 DEBUG_STRING_CASE(kPaintInvalidationClean); |
318 DEBUG_STRING_CASE(kInPrePaint); | 336 DEBUG_STRING_CASE(kInPrePaint); |
319 DEBUG_STRING_CASE(kPrePaintClean); | 337 DEBUG_STRING_CASE(kPrePaintClean); |
320 DEBUG_STRING_CASE(kInPaint); | 338 DEBUG_STRING_CASE(kInPaint); |
321 DEBUG_STRING_CASE(kPaintClean); | 339 DEBUG_STRING_CASE(kPaintClean); |
322 DEBUG_STRING_CASE(kStopping); | 340 DEBUG_STRING_CASE(kStopping); |
323 DEBUG_STRING_CASE(kStopped); | 341 DEBUG_STRING_CASE(kStopped); |
324 } | 342 } |
(...skipping 27 matching lines...) Expand all Loading... |
352 << " to " << StateAsDebugString(state) << "."; | 370 << " to " << StateAsDebugString(state) << "."; |
353 #endif | 371 #endif |
354 state_ = state; | 372 state_ = state; |
355 } | 373 } |
356 | 374 |
357 bool DocumentLifecycle::ThrottlingAllowed() const { | 375 bool DocumentLifecycle::ThrottlingAllowed() const { |
358 return g_allow_throttling_count; | 376 return g_allow_throttling_count; |
359 } | 377 } |
360 | 378 |
361 } // namespace blink | 379 } // namespace blink |
OLD | NEW |