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

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

Issue 183763016: Reduce compositing update in Silk's toggle_drawer by 20% (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix win build Created 6 years, 9 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #endif 197 #endif
198 }; 198 };
199 199
200 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) 200 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView)
201 : m_renderView(renderView) 201 : m_renderView(renderView)
202 , m_compositingReasonFinder(*renderView) 202 , m_compositingReasonFinder(*renderView)
203 , m_hasAcceleratedCompositing(true) 203 , m_hasAcceleratedCompositing(true)
204 , m_showRepaintCounter(false) 204 , m_showRepaintCounter(false)
205 , m_needsToRecomputeCompositingRequirements(false) 205 , m_needsToRecomputeCompositingRequirements(false)
206 , m_needsToUpdateLayerTreeGeometry(false) 206 , m_needsToUpdateLayerTreeGeometry(false)
207 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate)
207 , m_compositing(false) 208 , m_compositing(false)
208 , m_compositingLayersNeedRebuild(false) 209 , m_compositingLayersNeedRebuild(false)
209 , m_forceCompositingMode(false) 210 , m_forceCompositingMode(false)
210 , m_needsUpdateCompositingRequirementsState(false) 211 , m_needsUpdateCompositingRequirementsState(false)
211 , m_isTrackingRepaints(false) 212 , m_isTrackingRepaints(false)
212 , m_rootLayerAttachment(RootLayerUnattached) 213 , m_rootLayerAttachment(RootLayerUnattached)
213 { 214 {
214 ASSERT(renderView); 215 ASSERT(renderView);
215 } 216 }
216 217
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return; 356 return;
356 357
357 if (m_forceCompositingMode && !m_compositing) 358 if (m_forceCompositingMode && !m_compositing)
358 enableCompositingMode(true); 359 enableCompositingMode(true);
359 360
360 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) 361 if (!m_needsToRecomputeCompositingRequirements && !m_compositing)
361 return; 362 return;
362 363
363 switch (updateType) { 364 switch (updateType) {
364 case CompositingUpdateAfterStyleChange: 365 case CompositingUpdateAfterStyleChange:
366 m_needsToRecomputeCompositingRequirements = true;
367 break;
365 case CompositingUpdateAfterLayout: 368 case CompositingUpdateAfterLayout:
366 m_needsToRecomputeCompositingRequirements = true; 369 m_needsToRecomputeCompositingRequirements = true;
370 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
371 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
367 break; 372 break;
368 case CompositingUpdateOnScroll: 373 case CompositingUpdateOnScroll:
369 m_needsToRecomputeCompositingRequirements = true; // Overlap can change with scrolling, so need to check for hierarchy updates. 374 m_needsToRecomputeCompositingRequirements = true; // Overlap can change with scrolling, so need to check for hierarchy updates.
370 m_needsToUpdateLayerTreeGeometry = true; 375 m_needsToUpdateLayerTreeGeometry = true;
376 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
377 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
371 break; 378 break;
372 case CompositingUpdateOnCompositedScroll: 379 case CompositingUpdateOnCompositedScroll:
373 m_needsToUpdateLayerTreeGeometry = true; 380 m_needsToUpdateLayerTreeGeometry = true;
381 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
382 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
374 break; 383 break;
375 } 384 }
376 385
377 m_renderView->frameView()->scheduleAnimation(); 386 m_renderView->frameView()->scheduleAnimation();
378 } 387 }
379 388
380 void RenderLayerCompositor::updateCompositingLayers() 389 void RenderLayerCompositor::updateCompositingLayers()
381 { 390 {
382 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay ers"); 391 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay ers");
383 392
(...skipping 28 matching lines...) Expand all
412 return; 421 return;
413 422
414 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements; 423 bool needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequir ements;
415 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; 424 bool needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild;
416 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; 425 bool needGeometryUpdate = m_needsToUpdateLayerTreeGeometry;
417 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false; 426 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false;
418 427
419 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate && !needsToUpdateScrollingCoordinator) 428 if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate && !needGeometryUpdate && !needsToUpdateScrollingCoordinator)
420 return; 429 return;
421 430
431 GraphicsLayerUpdater::UpdateType updateType = m_pendingUpdateType;
432
422 // Only clear the flags if we're updating the entire hierarchy. 433 // Only clear the flags if we're updating the entire hierarchy.
423 m_compositingLayersNeedRebuild = false; 434 m_compositingLayersNeedRebuild = false;
424 m_needsToUpdateLayerTreeGeometry = false; 435 m_needsToUpdateLayerTreeGeometry = false;
425 m_needsToRecomputeCompositingRequirements = false; 436 m_needsToRecomputeCompositingRequirements = false;
437 m_pendingUpdateType = GraphicsLayerUpdater::DoNotForceUpdate;
438
426 RenderLayer* updateRoot = rootRenderLayer(); 439 RenderLayer* updateRoot = rootRenderLayer();
427 440
428 if (needCompositingRequirementsUpdate) { 441 if (needCompositingRequirementsUpdate) {
429 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers. 442 // Go through the layers in presentation order, so that we can compute w hich RenderLayers need compositing layers.
430 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex. 443 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b ut the parenting logic would be more complex.
431 CompositingRecursionData recursionData(updateRoot, 0, true); 444 CompositingRecursionData recursionData(updateRoot, 0, true);
432 bool layersChanged = false; 445 bool layersChanged = false;
433 bool saw3DTransform = false; 446 bool saw3DTransform = false;
434 { 447 {
435 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements"); 448 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo sitingRequirements");
(...skipping 28 matching lines...) Expand all
464 477
465 if (layersChanged) 478 if (layersChanged)
466 needHierarchyAndGeometryUpdate = true; 479 needHierarchyAndGeometryUpdate = true;
467 } 480 }
468 481
469 if (needHierarchyAndGeometryUpdate) { 482 if (needHierarchyAndGeometryUpdate) {
470 // Update the hierarchy of the compositing layers. 483 // Update the hierarchy of the compositing layers.
471 Vector<GraphicsLayer*> childList; 484 Vector<GraphicsLayer*> childList;
472 { 485 {
473 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree") ; 486 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::rebuildTree") ;
474 GraphicsLayerUpdater(*m_renderView).rebuildTree(*updateRoot, childLi st, 0); 487 GraphicsLayerUpdater(*m_renderView).rebuildTree(*updateRoot, updateT ype, childList, 0);
475 } 488 }
476 489
477 // Host the document layer in the RenderView's root layer. 490 // Host the document layer in the RenderView's root layer.
478 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra me()) { 491 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFra me()) {
479 RenderVideo* video = findFullscreenVideoRenderer(m_renderView->docum ent()); 492 RenderVideo* video = findFullscreenVideoRenderer(m_renderView->docum ent());
480 if (video && video->hasCompositedLayerMapping()) { 493 if (video && video->hasCompositedLayerMapping()) {
481 childList.clear(); 494 childList.clear();
482 childList.append(video->compositedLayerMapping()->mainGraphicsLa yer()); 495 childList.append(video->compositedLayerMapping()->mainGraphicsLa yer());
483 } 496 }
484 } 497 }
485 498
486 if (childList.isEmpty()) 499 if (childList.isEmpty())
487 destroyRootLayer(); 500 destroyRootLayer();
488 else 501 else
489 m_rootContentLayer->setChildren(childList); 502 m_rootContentLayer->setChildren(childList);
490 } else if (needGeometryUpdate) { 503 } else if (needGeometryUpdate) {
491 // We just need to do a geometry update. This is only used for position: fixed scrolling; 504 // We just need to do a geometry update. This is only used for position: fixed scrolling;
492 // most of the time, geometry is updated via RenderLayer::styleChanged() . 505 // most of the time, geometry is updated via RenderLayer::styleChanged() .
493 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive") ; 506 TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive") ;
494 GraphicsLayerUpdater(*m_renderView).updateRecursive(*updateRoot); 507 GraphicsLayerUpdater(*m_renderView).updateRecursive(*updateRoot, updateT ype);
495 } 508 }
496 509
497 ASSERT(updateRoot || !m_compositingLayersNeedRebuild); 510 ASSERT(updateRoot || !m_compositingLayersNeedRebuild);
498 511
499 if (!hasAcceleratedCompositing()) 512 if (!hasAcceleratedCompositing())
500 enableCompositingMode(false); 513 enableCompositingMode(false);
501 514
502 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function. 515 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function.
503 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord inator()->needsToUpdateAfterCompositingChange() : false; 516 needsToUpdateScrollingCoordinator |= scrollingCoordinator() ? scrollingCoord inator()->needsToUpdateAfterCompositingChange() : false;
504 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat or() && inCompositingMode()) 517 if (needsToUpdateScrollingCoordinator && isMainFrame() && scrollingCoordinat or() && inCompositingMode())
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 if (layer->hasCompositedLayerMapping()) { 1408 if (layer->hasCompositedLayerMapping()) {
1396 CompositedLayerMappingPtr compositedLayerMapping = layer->composited LayerMapping(); 1409 CompositedLayerMappingPtr compositedLayerMapping = layer->composited LayerMapping();
1397 compositedLayerMapping->updateCompositedBounds(); 1410 compositedLayerMapping->updateCompositedBounds();
1398 1411
1399 if (layer->reflectionInfo()) { 1412 if (layer->reflectionInfo()) {
1400 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflecti onLayer(); 1413 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflecti onLayer();
1401 if (reflectionLayer->hasCompositedLayerMapping()) 1414 if (reflectionLayer->hasCompositedLayerMapping())
1402 reflectionLayer->compositedLayerMapping()->updateCompositedB ounds(); 1415 reflectionLayer->compositedLayerMapping()->updateCompositedB ounds();
1403 } 1416 }
1404 1417
1405 compositedLayerMapping->updateGraphicsLayerGeometry(); 1418 compositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpd ater::ForceUpdate);
1406 if (compositedChildrenOnly) 1419 if (compositedChildrenOnly)
1407 return; 1420 return;
1408 } 1421 }
1409 } 1422 }
1410 1423
1411 if (layer->reflectionInfo()) 1424 if (layer->reflectionInfo())
1412 updateCompositingDescendantGeometry(compositingAncestor, layer->reflecti onInfo()->reflectionLayer(), compositedChildrenOnly); 1425 updateCompositingDescendantGeometry(compositingAncestor, layer->reflecti onInfo()->reflectionLayer(), compositedChildrenOnly);
1413 1426
1414 if (!layer->hasCompositingDescendant()) 1427 if (!layer->hasCompositingDescendant())
1415 return; 1428 return;
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 } else if (graphicsLayer == m_scrollLayer.get()) { 2247 } else if (graphicsLayer == m_scrollLayer.get()) {
2235 name = "LocalFrame Scrolling Layer"; 2248 name = "LocalFrame Scrolling Layer";
2236 } else { 2249 } else {
2237 ASSERT_NOT_REACHED(); 2250 ASSERT_NOT_REACHED();
2238 } 2251 }
2239 2252
2240 return name; 2253 return name;
2241 } 2254 }
2242 2255
2243 } // namespace WebCore 2256 } // 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