Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: Source/core/rendering/compositing/RenderLayerCompositor.cpp

Issue 213833014: Merge two update type fields in RenderLayerCompositor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moar asserts Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 bool m_hasUnisolatedCompositedBlendingDescendant; 191 bool m_hasUnisolatedCompositedBlendingDescendant;
192 bool m_testingOverlap; 192 bool m_testingOverlap;
193 #ifndef NDEBUG 193 #ifndef NDEBUG
194 int m_depth; 194 int m_depth;
195 #endif 195 #endif
196 }; 196 };
197 197
198 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) 198 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView)
199 : m_renderView(renderView) 199 : m_renderView(renderView)
200 , m_compositingReasonFinder(renderView) 200 , m_compositingReasonFinder(renderView)
201 , m_pendingUpdateType(CompositingUpdateNone)
201 , m_hasAcceleratedCompositing(true) 202 , m_hasAcceleratedCompositing(true)
202 , m_showRepaintCounter(false) 203 , m_showRepaintCounter(false)
203 , m_needsToRecomputeCompositingRequirements(false) 204 , m_needsToRecomputeCompositingRequirements(false)
204 , m_needsToUpdateLayerTreeGeometry(false) 205 , m_needsToUpdateLayerTreeGeometry(false)
205 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate)
206 , m_pendingPropertyUpdateType(CompositingPropertyUpdater::DoNotForceUpdate)
207 , m_compositing(false) 206 , m_compositing(false)
208 , m_compositingLayersNeedRebuild(false) 207 , m_compositingLayersNeedRebuild(false)
209 , m_forceCompositingMode(false) 208 , m_forceCompositingMode(false)
210 , m_needsUpdateCompositingRequirementsState(false) 209 , m_needsUpdateCompositingRequirementsState(false)
211 , m_isTrackingRepaints(false) 210 , m_isTrackingRepaints(false)
212 , m_rootLayerAttachment(RootLayerUnattached) 211 , m_rootLayerAttachment(RootLayerUnattached)
213 { 212 {
214 } 213 }
215 214
216 RenderLayerCompositor::~RenderLayerCompositor() 215 RenderLayerCompositor::~RenderLayerCompositor()
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Update compositing for current frame after all descendant frames are upda ted. 336 // Update compositing for current frame after all descendant frames are upda ted.
338 if (frame && frame->contentRenderer()) { 337 if (frame && frame->contentRenderer()) {
339 RenderLayerCompositor* frameCompositor = frame->contentRenderer()->compo sitor(); 338 RenderLayerCompositor* frameCompositor = frame->contentRenderer()->compo sitor();
340 if (frameCompositor && !frameCompositor->isMainFrame()) 339 if (frameCompositor && !frameCompositor->isMainFrame())
341 frame->contentRenderer()->compositor()->updateCompositingLayers(); 340 frame->contentRenderer()->compositor()->updateCompositingLayers();
342 } 341 }
343 } 342 }
344 343
345 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda teType) 344 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda teType)
346 { 345 {
346 ASSERT(updateType != CompositingUpdateNone);
347 // FIXME: this code was historically part of updateCompositingLayers, and 347 // FIXME: this code was historically part of updateCompositingLayers, and
348 // for now is kept totally equivalent to the previous implementation. We 348 // for now is kept totally equivalent to the previous implementation. We
349 // should carefully clean up the awkward early-exit semantics, balancing bet ween 349 // should carefully clean up the awkward early-exit semantics, balancing bet ween
350 // skipping unnecessary compositing updates and not incorrectly skipping 350 // skipping unnecessary compositing updates and not incorrectly skipping
351 // necessary updates. 351 // necessary updates.
352 352
353 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. 353 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished.
354 if (m_renderView.needsLayout()) 354 if (m_renderView.needsLayout())
355 return; 355 return;
356 356
357 if (m_forceCompositingMode && !m_compositing) 357 if (m_forceCompositingMode && !m_compositing)
358 enableCompositingMode(true); 358 enableCompositingMode(true);
359 359
360 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) 360 if (!m_needsToRecomputeCompositingRequirements && !m_compositing)
361 return; 361 return;
362 362
363 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType);
364
363 switch (updateType) { 365 switch (updateType) {
366 case CompositingUpdateNone:
367 ASSERT_NOT_REACHED();
368 break;
364 case CompositingUpdateAfterStyleChange: 369 case CompositingUpdateAfterStyleChange:
365 m_needsToRecomputeCompositingRequirements = true; 370 m_needsToRecomputeCompositingRequirements = true;
366 break; 371 break;
367 case CompositingUpdateAfterLayout: 372 case CompositingUpdateAfterLayout:
368 m_needsToRecomputeCompositingRequirements = true; 373 m_needsToRecomputeCompositingRequirements = true;
369 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
370 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
371 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
372 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate;
373 break; 374 break;
374 case CompositingUpdateOnScroll: 375 case CompositingUpdateOnScroll:
375 m_needsToRecomputeCompositingRequirements = true; // Overlap can change with scrolling, so need to check for hierarchy updates. 376 m_needsToRecomputeCompositingRequirements = true; // Overlap can change with scrolling, so need to check for hierarchy updates.
376 m_needsToUpdateLayerTreeGeometry = true; 377 m_needsToUpdateLayerTreeGeometry = true;
377 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
378 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
379 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
380 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate;
381 break; 378 break;
382 case CompositingUpdateOnCompositedScroll: 379 case CompositingUpdateOnCompositedScroll:
383 m_needsToUpdateLayerTreeGeometry = true; 380 m_needsToUpdateLayerTreeGeometry = true;
384 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
385 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
386 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
387 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate;
388 break; 381 break;
389 case CompositingUpdateAfterCanvasContextChange: 382 case CompositingUpdateAfterCanvasContextChange:
390 m_needsToUpdateLayerTreeGeometry = true; 383 m_needsToUpdateLayerTreeGeometry = true;
391 break; 384 break;
392 } 385 }
393 386
394 page()->animator().scheduleVisualUpdate(); 387 page()->animator().scheduleVisualUpdate();
395 } 388 }
396 389
397 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) 390 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { 430 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) {
438 m_renderView.frameView()->scheduleAnimation(); 431 m_renderView.frameView()->scheduleAnimation();
439 return; 432 return;
440 } 433 }
441 } 434 }
442 } 435 }
443 } 436 }
444 437
445 bool RenderLayerCompositor::hasUnresolvedDirtyBits() 438 bool RenderLayerCompositor::hasUnresolvedDirtyBits()
446 { 439 {
447 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen tsState || m_pendingUpdateType != GraphicsLayerUpdater::DoNotForceUpdate; 440 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen tsState || m_pendingUpdateType > CompositingUpdateNone;
448 } 441 }
449 442
450 void RenderLayerCompositor::updateCompositingLayersInternal() 443 void RenderLayerCompositor::updateCompositingLayersInternal()
451 { 444 {
452 if (isMainFrame() && m_renderView.frameView()) 445 if (isMainFrame() && m_renderView.frameView())
453 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); 446 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame());
454 447
455 if (m_forceCompositingMode && !m_compositing) 448 if (m_forceCompositingMode && !m_compositing)
456 enableCompositingMode(true); 449 enableCompositingMode(true);
457 450
458 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) 451 if (!m_needsToRecomputeCompositingRequirements && !m_compositing)
459 return; 452 return;
460 453
454 CompositingUpdateType updateType = m_pendingUpdateType;
455
461 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements; 456 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements;
462 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; 457 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild;
463 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; 458 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry;
464 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false; 459 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false;
465 460
466 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate && !needsToUpdateScrollingCoordinator) 461 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate && !needsToUpdateScrollingCoordinator)
467 return; 462 return;
468 463
469 GraphicsLayerUpdater::UpdateType updateType = m_pendingUpdateType; 464 m_pendingUpdateType = CompositingUpdateNone;
465
466 GraphicsLayerUpdater::UpdateType graphicsLayerUpdateType = GraphicsLayerUpda ter::DoNotForceUpdate;
467 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo sitingPropertyUpdater::DoNotForceUpdate;
468
469 // FIXME: Teach non-style compositing updates how to do partial tree walks.
470 if (updateType >= CompositingUpdateAfterLayout) {
471 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate;
472 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate;
473 }
470 474
471 // Only clear the flags if we're updating the entire hierarchy. 475 // Only clear the flags if we're updating the entire hierarchy.
472 m_compositingLayersNeedRebuild = false; 476 m_compositingLayersNeedRebuild = false;
473 m_needsToUpdateLayerTreeGeometry = false; 477 m_needsToUpdateLayerTreeGeometry = false;
474 m_needsToRecomputeCompositingRequirements = false; 478 m_needsToRecomputeCompositingRequirements = false;
475 m_pendingUpdateType = GraphicsLayerUpdater::DoNotForceUpdate;
476 479
477 RenderLayer* updateRoot = rootRenderLayer(); 480 RenderLayer* updateRoot = rootRenderLayer();
478 481
479 if (needCompositingRequirementsUpdate) { 482 if (needCompositingRequirementsUpdate) {
480 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers. 483 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers.
481 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex. 484 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex.
482 CompositingRecursionData recursionData(updateRoot, 0, true); 485 CompositingRecursionData recursionData(updateRoot, 0, true);
483 bool layersChanged = false; 486 bool layersChanged = false;
484 bool saw3DTransform = false; 487 bool saw3DTransform = false;
485 488
486 { 489 {
487 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties"); 490 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties");
488 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, m_pendingPropertyUpdateType, 0); 491 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, compositingPropertyUpdateType, 0);
489 m_pendingPropertyUpdateType = CompositingPropertyUpdater::DoNotForce Update;
490 #if !ASSERT_DISABLED 492 #if !ASSERT_DISABLED
491 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot); 493 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot);
492 #endif 494 #endif
493 } 495 }
494 496
495 { 497 {
496 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements"); 498 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements");
497 OverlapMap overlapTestRequestMap; 499 OverlapMap overlapTestRequestMap;
498 500
499 // FIXME: Passing these unclippedDescendants down and keeping track 501 // FIXME: Passing these unclippedDescendants down and keeping track
(...skipping 18 matching lines...) Expand all
518 (*it)->updateHasVisibleNonLayerContent(); 520 (*it)->updateHasVisibleNonLayerContent();
519 } 521 }
520 } 522 }
521 523
522 if (layersChanged) 524 if (layersChanged)
523 needHierarchyAndGeometryUpdate = true; 525 needHierarchyAndGeometryUpdate = true;
524 } 526 }
525 527
526 if (needGeometryUpdate || needHierarchyAndGeometryUpdate) { 528 if (needGeometryUpdate || needHierarchyAndGeometryUpdate) {
527 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive") ; 529 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive") ;
528 GraphicsLayerUpdater().update(*updateRoot, updateType); 530 GraphicsLayerUpdater().update(*updateRoot, graphicsLayerUpdateType);
529 #if !ASSERT_DISABLED 531 #if !ASSERT_DISABLED
530 // FIXME: Move this check to the end of the compositing update. 532 // FIXME: Move this check to the end of the compositing update.
531 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat eRoot); 533 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat eRoot);
532 #endif 534 #endif
533 } 535 }
534 536
535 if (needHierarchyAndGeometryUpdate) { 537 if (needHierarchyAndGeometryUpdate) {
536 // Update the hierarchy of the compositing layers. 538 // Update the hierarchy of the compositing layers.
537 GraphicsLayerVector childList; 539 GraphicsLayerVector childList;
538 { 540 {
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 } else if (graphicsLayer == m_scrollLayer.get()) { 2152 } else if (graphicsLayer == m_scrollLayer.get()) {
2151 name = "LocalFrame Scrolling Layer"; 2153 name = "LocalFrame Scrolling Layer";
2152 } else { 2154 } else {
2153 ASSERT_NOT_REACHED(); 2155 ASSERT_NOT_REACHED();
2154 } 2156 }
2155 2157
2156 return name; 2158 return name;
2157 } 2159 }
2158 2160
2159 } // namespace WebCore 2161 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698