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

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

Issue 202533003: Don't schedule an animation during compositing dirty-bit setting unless needed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Cleanup. 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
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 bool RenderLayerCompositor::canRender3DTransforms() const 278 bool RenderLayerCompositor::canRender3DTransforms() const
279 { 279 {
280 return hasAcceleratedCompositing() && m_compositingReasonFinder.has3DTransfo rmTrigger(); 280 return hasAcceleratedCompositing() && m_compositingReasonFinder.has3DTransfo rmTrigger();
281 } 281 }
282 282
283 void RenderLayerCompositor::setCompositingLayersNeedRebuild() 283 void RenderLayerCompositor::setCompositingLayersNeedRebuild()
284 { 284 {
285 // FIXME: crbug,com/332248 ideally this could be merged with setNeedsComposi tingUpdate(). 285 // FIXME: crbug,com/332248 ideally this could be merged with setNeedsComposi tingUpdate().
286 if (inCompositingMode()) 286 if (inCompositingMode())
287 m_compositingLayersNeedRebuild = true; 287 m_compositingLayersNeedRebuild = true;
288 288 page()->animator().scheduleVisualUpdate();
289 m_renderView.frameView()->scheduleAnimation();
290 } 289 }
291 290
292 void RenderLayerCompositor::updateCompositingRequirementsState() 291 void RenderLayerCompositor::updateCompositingRequirementsState()
293 { 292 {
294 if (!m_needsUpdateCompositingRequirementsState) 293 if (!m_needsUpdateCompositingRequirementsState)
295 return; 294 return;
296 295
297 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo mpositingRequirementsState"); 296 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo mpositingRequirementsState");
298 297
299 m_needsUpdateCompositingRequirementsState = false; 298 m_needsUpdateCompositingRequirementsState = false;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 case CompositingUpdateOnCompositedScroll: 377 case CompositingUpdateOnCompositedScroll:
379 m_needsToUpdateLayerTreeGeometry = true; 378 m_needsToUpdateLayerTreeGeometry = true;
380 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here. 379 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't need a ForceUpdate here.
381 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; 380 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate;
382 break; 381 break;
383 case CompositingUpdateAfterCanvasContextChange: 382 case CompositingUpdateAfterCanvasContextChange:
384 m_needsToUpdateLayerTreeGeometry = true; 383 m_needsToUpdateLayerTreeGeometry = true;
385 break; 384 break;
386 } 385 }
387 386
388 m_renderView.frameView()->scheduleAnimation(); 387 page()->animator().scheduleVisualUpdate();
389 } 388 }
390 389
391 void RenderLayerCompositor::updateCompositingLayers() 390 void RenderLayerCompositor::updateCompositingLayers()
392 { 391 {
393 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay ers"); 392 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateCompositingLay ers");
394 393
395 // FIXME: We should carefully clean up the awkward early-exit semantics, bal ancing 394 // FIXME: We should carefully clean up the awkward early-exit semantics, bal ancing
396 // between skipping unnecessary compositing updates and not incorrectly skip ping 395 // between skipping unnecessary compositing updates and not incorrectly skip ping
397 // necessary updates. 396 // necessary updates.
398 397
399 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished. 398 // Avoid updating the layers with old values. Compositing layers will be upd ated after the layout is finished.
400 // FIXME: Can we assert that we never return here? 399 // FIXME: Can we assert that we never return here?
401 if (m_renderView.needsLayout()) 400 if (m_renderView.needsLayout())
402 return; 401 return;
403 402
404 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); 403 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate);
405 404
406 updateCompositingLayersInternal(); 405 updateCompositingLayersInternal();
407 406
408 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); 407 lifecycle().advanceTo(DocumentLifecycle::CompositingClean);
409 408
410 DocumentAnimations::startPendingAnimations(m_renderView.document()); 409 DocumentAnimations::startPendingAnimations(m_renderView.document());
411 ASSERT(m_renderView.document().lifecycle().state() == DocumentLifecycle::Com positingClean); 410 ASSERT(m_renderView.document().lifecycle().state() == DocumentLifecycle::Com positingClean);
412 } 411 }
413 412
413 void RenderLayerCompositor::scheduleAnimationIfNeeded()
414 {
415 if (hasUnresolvedDirtyBits())
416 m_renderView.frameView()->scheduleAnimation();
abarth-chromium 2014/03/19 18:04:57 Should we early return here?
chrishtr 2014/03/19 18:16:00 Done. Confirmed with enne@ that this is ok.
417
418 LocalFrame* localFrame = &m_renderView.frameView()->frame();
419 for (LocalFrame* child = localFrame->tree().firstChild(); child; child = chi ld->tree().nextSibling()) {
420 if (child->contentRenderer()) {
421 RenderLayerCompositor* childCompositor = child->contentRenderer()->c ompositor();
422 if (childCompositor)
423 childCompositor->scheduleAnimationIfNeeded();
abarth-chromium 2014/03/19 18:04:57 Rather than using recursion here, we can use frame
chrishtr 2014/03/19 18:16:00 Done.
424 }
425 }
426 }
427
428 bool RenderLayerCompositor::hasUnresolvedDirtyBits()
429 {
430 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen tsState || m_pendingUpdateType != GraphicsLayerUpdater::DoNotForceUpdate;
431 }
432
414 void RenderLayerCompositor::updateCompositingLayersInternal() 433 void RenderLayerCompositor::updateCompositingLayersInternal()
415 { 434 {
416 if (isMainFrame() && m_renderView.frameView()) 435 if (isMainFrame() && m_renderView.frameView())
417 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); 436 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame());
418 437
419 if (m_forceCompositingMode && !m_compositing) 438 if (m_forceCompositingMode && !m_compositing)
420 enableCompositingMode(true); 439 enableCompositingMode(true);
421 440
422 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) 441 if (!m_needsToRecomputeCompositingRequirements && !m_compositing)
423 return; 442 return;
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 } else if (graphicsLayer == m_scrollLayer.get()) { 2262 } else if (graphicsLayer == m_scrollLayer.get()) {
2244 name = "LocalFrame Scrolling Layer"; 2263 name = "LocalFrame Scrolling Layer";
2245 } else { 2264 } else {
2246 ASSERT_NOT_REACHED(); 2265 ASSERT_NOT_REACHED();
2247 } 2266 }
2248 2267
2249 return name; 2268 return name;
2250 } 2269 }
2251 2270
2252 } // namespace WebCore 2271 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | Source/web/PageWidgetDelegate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698