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

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: Add null check. 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 LocalFrame* localFrame = &m_renderView.frameView()->frame();
416 for (LocalFrame* currentFrame = localFrame; currentFrame; currentFrame = cur rentFrame->tree().traverseNext(localFrame)) {
417 if (currentFrame->contentRenderer()) {
418 RenderLayerCompositor* childCompositor = currentFrame->contentRender er()->compositor();
419 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) {
420 m_renderView.frameView()->scheduleAnimation();
421 return;
422 }
423 }
424 }
425 }
426
427 bool RenderLayerCompositor::hasUnresolvedDirtyBits()
428 {
429 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen tsState || m_pendingUpdateType != GraphicsLayerUpdater::DoNotForceUpdate;
430 }
431
414 void RenderLayerCompositor::updateCompositingLayersInternal() 432 void RenderLayerCompositor::updateCompositingLayersInternal()
415 { 433 {
416 if (isMainFrame() && m_renderView.frameView()) 434 if (isMainFrame() && m_renderView.frameView())
417 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); 435 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame());
418 436
419 if (m_forceCompositingMode && !m_compositing) 437 if (m_forceCompositingMode && !m_compositing)
420 enableCompositingMode(true); 438 enableCompositingMode(true);
421 439
422 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) 440 if (!m_needsToRecomputeCompositingRequirements && !m_compositing)
423 return; 441 return;
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 } else if (graphicsLayer == m_scrollLayer.get()) { 2258 } else if (graphicsLayer == m_scrollLayer.get()) {
2241 name = "LocalFrame Scrolling Layer"; 2259 name = "LocalFrame Scrolling Layer";
2242 } else { 2260 } else {
2243 ASSERT_NOT_REACHED(); 2261 ASSERT_NOT_REACHED();
2244 } 2262 }
2245 2263
2246 return name; 2264 return name;
2247 } 2265 }
2248 2266
2249 } // namespace WebCore 2267 } // 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