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

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

Issue 316513002: Various cleanups to compositing code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 6 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); 257 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate);
258 258
259 updateIfNeeded(); 259 updateIfNeeded();
260 260
261 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); 261 lifecycle().advanceTo(DocumentLifecycle::CompositingClean);
262 262
263 DocumentAnimations::startPendingAnimations(m_renderView.document()); 263 DocumentAnimations::startPendingAnimations(m_renderView.document());
264 // TODO: Figure out why this fails on Chrome OS login page. crbug.com/365507 264 // TODO: Figure out why this fails on Chrome OS login page. crbug.com/365507
265 // ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean); 265 // ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean);
266 266
267 #if ASSERT_ENABLED
267 assertNoUnresolvedDirtyBits(); 268 assertNoUnresolvedDirtyBits();
268 for (LocalFrame* child = m_renderView.frameView()->frame().tree().firstChild (); child; child = child->tree().nextSibling()) 269 for (LocalFrame* child = m_renderView.frameView()->frame().tree().firstChild (); child; child = child->tree().nextSibling())
269 child->contentRenderer()->compositor()->assertNoUnresolvedDirtyBits(); 270 child->contentRenderer()->compositor()->assertNoUnresolvedDirtyBits();
271 #endif
270 } 272 }
271 273
272 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda teType) 274 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda teType)
273 { 275 {
274 ASSERT(updateType != CompositingUpdateNone); 276 ASSERT(updateType != CompositingUpdateNone);
275 // FIXME: Technically we only need to do this when the FrameView's isScrolla ble method 277 // FIXME: Technically we only need to do this when the FrameView's isScrolla ble method
276 // would return a different value. 278 // would return a different value.
277 if (updateType == CompositingUpdateAfterLayout) 279 if (updateType == CompositingUpdateAfterLayout)
278 m_rootShouldAlwaysCompositeDirty = true; 280 m_rootShouldAlwaysCompositeDirty = true;
279 281
280 // FIXME: This function should only set dirty bits. We shouldn't 282 // FIXME: This function should only set dirty bits. We shouldn't
281 // enable compositing mode here. 283 // enable compositing mode here.
282 // We check needsLayout here because we don't know if we need to enable 284 // We check needsLayout here because we don't know if we need to enable
283 // compositing mode until layout is up-to-date because we need to know 285 // compositing mode until layout is up-to-date because we need to know
284 // if this frame scrolls. 286 // if this frame scrolls.
285 if (!m_renderView.needsLayout()) 287 if (!m_renderView.needsLayout())
286 enableCompositingModeIfNeeded(); 288 enableCompositingModeIfNeeded();
287 289
288 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); 290 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType);
289 291
290 page()->animator().scheduleVisualUpdate(); 292 page()->animator().scheduleVisualUpdate();
291 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); 293 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean);
292 } 294 }
293 295
296 #if ASSERT_ENABLED
297
294 void RenderLayerCompositor::assertNoUnresolvedDirtyBits() 298 void RenderLayerCompositor::assertNoUnresolvedDirtyBits()
295 { 299 {
296 ASSERT(!compositingLayersNeedRebuild()); 300 ASSERT(!compositingLayersNeedRebuild());
297 ASSERT(m_pendingUpdateType == CompositingUpdateNone); 301 ASSERT(m_pendingUpdateType == CompositingUpdateNone);
298 ASSERT(!m_rootShouldAlwaysCompositeDirty); 302 ASSERT(!m_rootShouldAlwaysCompositeDirty);
299 } 303 }
300 304
305 #endif
306
301 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() 307 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment()
302 { 308 {
303 if (!m_rootContentLayer) 309 if (!m_rootContentLayer)
304 return; 310 return;
305 311
306 bool isMainFrame = m_renderView.frame()->isMainFrame(); 312 bool isMainFrame = m_renderView.frame()->isMainFrame();
307 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.document()); 313 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.document());
308 if (!video || !video->hasCompositedLayerMapping()) { 314 if (!video || !video->hasCompositedLayerMapping()) {
309 if (isMainFrame) { 315 if (isMainFrame) {
310 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer(); 316 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 351
346 CompositingUpdateType updateType = m_pendingUpdateType; 352 CompositingUpdateType updateType = m_pendingUpdateType;
347 bool needHierarchyAndGeometryUpdate = compositingLayersNeedRebuild(); 353 bool needHierarchyAndGeometryUpdate = compositingLayersNeedRebuild();
348 354
349 m_pendingUpdateType = CompositingUpdateNone; 355 m_pendingUpdateType = CompositingUpdateNone;
350 m_compositingLayersNeedRebuild = false; 356 m_compositingLayersNeedRebuild = false;
351 357
352 if (!hasAcceleratedCompositing()) 358 if (!hasAcceleratedCompositing())
353 return; 359 return;
354 360
355 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() ? scrollingC oordinator()->needsToUpdateAfterCompositingChange() : false; 361 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() && scrolling Coordinator()->needsToUpdateAfterCompositingChange();
356 if (updateType == CompositingUpdateNone && !needHierarchyAndGeometryUpdate & & !needsToUpdateScrollingCoordinator) 362 if (updateType == CompositingUpdateNone && !needHierarchyAndGeometryUpdate & & !needsToUpdateScrollingCoordinator)
357 return; 363 return;
358 364
359 GraphicsLayerUpdater::UpdateType graphicsLayerUpdateType = GraphicsLayerUpda ter::DoNotForceUpdate; 365 GraphicsLayerUpdater::UpdateType graphicsLayerUpdateType = GraphicsLayerUpda ter::DoNotForceUpdate;
360 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo sitingPropertyUpdater::DoNotForceUpdate; 366 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo sitingPropertyUpdater::DoNotForceUpdate;
361 367
362 // FIXME: Teach non-style compositing updates how to do partial tree walks. 368 // FIXME: Teach non-style compositing updates how to do partial tree walks.
363 if (updateType >= CompositingUpdateAfterLayout) { 369 if (updateType >= CompositingUpdateAfterLayout) {
364 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate; 370 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate;
365 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; 371 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate;
(...skipping 14 matching lines...) Expand all
380 386
381 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot); 387 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot);
382 388
383 { 389 {
384 TRACE_EVENT0("blink_rendering", "CompositingLayerAssigner::assign"); 390 TRACE_EVENT0("blink_rendering", "CompositingLayerAssigner::assign");
385 CompositingLayerAssigner(this).assign(updateRoot, layersChanged); 391 CompositingLayerAssigner(this).assign(updateRoot, layersChanged);
386 } 392 }
387 393
388 { 394 {
389 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateAfterC ompositingChange"); 395 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateAfterC ompositingChange");
390 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView.f rameView()->scrollableAreas(); 396 if (const FrameView::ScrollableAreaSet* scrollableAreas = m_renderVi ew.frameView()->scrollableAreas()) {
391 if (scrollableAreas) {
392 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas ->begin(); it != scrollableAreas->end(); ++it) 397 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas ->begin(); it != scrollableAreas->end(); ++it)
393 (*it)->updateAfterCompositingChange(); 398 (*it)->updateAfterCompositingChange();
394 } 399 }
395 } 400 }
396 401
397 if (layersChanged) 402 if (layersChanged)
398 needHierarchyAndGeometryUpdate = true; 403 needHierarchyAndGeometryUpdate = true;
399 } 404 }
400 405
401 if (updateType != CompositingUpdateNone || needHierarchyAndGeometryUpdate) { 406 if (updateType != CompositingUpdateNone || needHierarchyAndGeometryUpdate) {
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 } else if (graphicsLayer == m_scrollLayer.get()) { 1388 } else if (graphicsLayer == m_scrollLayer.get()) {
1384 name = "LocalFrame Scrolling Layer"; 1389 name = "LocalFrame Scrolling Layer";
1385 } else { 1390 } else {
1386 ASSERT_NOT_REACHED(); 1391 ASSERT_NOT_REACHED();
1387 } 1392 }
1388 1393
1389 return name; 1394 return name;
1390 } 1395 }
1391 1396
1392 } // namespace WebCore 1397 } // 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