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

Side by Side Diff: cc/layer_tree_host_common.cc

Issue 11048044: cc: Switch to Chromium DCHECKs and LOGs (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove-rebased-asserts Created 8 years, 2 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #include "CCLayerTreeHostCommon.h" 8 #include "CCLayerTreeHostCommon.h"
9 9
10 #include "CCLayerImpl.h" 10 #include "CCLayerImpl.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 template<typename LayerType> 106 template<typename LayerType>
107 static inline bool layerClipsSubtree(LayerType* layer) 107 static inline bool layerClipsSubtree(LayerType* layer)
108 { 108 {
109 return layer->masksToBounds() || layer->maskLayer(); 109 return layer->masksToBounds() || layer->maskLayer();
110 } 110 }
111 111
112 template<typename LayerType> 112 template<typename LayerType>
113 static IntRect calculateVisibleContentRect(LayerType* layer) 113 static IntRect calculateVisibleContentRect(LayerType* layer)
114 { 114 {
115 ASSERT(layer->renderTarget()); 115 DCHECK(layer->renderTarget());
116 116
117 // Nothing is visible if the layer bounds are empty. 117 // Nothing is visible if the layer bounds are empty.
118 if (!layer->drawsContent() || layer->contentBounds().isEmpty() || layer->dra wableContentRect().isEmpty()) 118 if (!layer->drawsContent() || layer->contentBounds().isEmpty() || layer->dra wableContentRect().isEmpty())
119 return IntRect(); 119 return IntRect();
120 120
121 IntRect targetSurfaceClipRect; 121 IntRect targetSurfaceClipRect;
122 122
123 // First, compute visible bounds in target surface space. 123 // First, compute visible bounds in target surface space.
124 if (layer->renderTarget()->renderSurface()->clipRect().isEmpty()) 124 if (layer->renderTarget()->renderSurface()->clipRect().isEmpty())
125 targetSurfaceClipRect = layer->drawableContentRect(); 125 targetSurfaceClipRect = layer->drawableContentRect();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // 180 //
181 // Note, if the layer should not have been drawn due to being fully transpar ent, 181 // Note, if the layer should not have been drawn due to being fully transpar ent,
182 // we would have skipped the entire subtree and never made it into this func tion, 182 // we would have skipped the entire subtree and never made it into this func tion,
183 // so it is safe to omit this check here. 183 // so it is safe to omit this check here.
184 184
185 if (!layer->drawsContent() || layer->bounds().isEmpty()) 185 if (!layer->drawsContent() || layer->bounds().isEmpty())
186 return true; 186 return true;
187 187
188 LayerType* backfaceTestLayer = layer; 188 LayerType* backfaceTestLayer = layer;
189 if (layer->useParentBackfaceVisibility()) { 189 if (layer->useParentBackfaceVisibility()) {
190 ASSERT(layer->parent()); 190 DCHECK(layer->parent());
191 ASSERT(!layer->parent()->useParentBackfaceVisibility()); 191 DCHECK(!layer->parent()->useParentBackfaceVisibility());
192 backfaceTestLayer = layer->parent(); 192 backfaceTestLayer = layer->parent();
193 } 193 }
194 194
195 // The layer should not be drawn if (1) it is not double-sided and (2) the b ack of the layer is known to be facing the screen. 195 // The layer should not be drawn if (1) it is not double-sided and (2) the b ack of the layer is known to be facing the screen.
196 if (!backfaceTestLayer->doubleSided() && transformToScreenIsKnown(backfaceTe stLayer) && isLayerBackFaceVisible(backfaceTestLayer)) 196 if (!backfaceTestLayer->doubleSided() && transformToScreenIsKnown(backfaceTe stLayer) && isLayerBackFaceVisible(backfaceTestLayer))
197 return true; 197 return true;
198 198
199 return false; 199 return false;
200 } 200 }
201 201
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // Should be called just before the recursive calculateDrawTransformsInternal(). 347 // Should be called just before the recursive calculateDrawTransformsInternal().
348 template<typename LayerType, typename LayerList> 348 template<typename LayerType, typename LayerList>
349 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize) 349 void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rSurfaceLayerList, const IntSize& deviceViewportSize)
350 { 350 {
351 if (!rootLayer->renderSurface()) 351 if (!rootLayer->renderSurface())
352 rootLayer->createRenderSurface(); 352 rootLayer->createRenderSurface();
353 353
354 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize)); 354 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceV iewportSize));
355 rootLayer->renderSurface()->clearLayerLists(); 355 rootLayer->renderSurface()->clearLayerLists();
356 356
357 ASSERT(renderSurfaceLayerList.empty()); 357 DCHECK(renderSurfaceLayerList.empty());
358 renderSurfaceLayerList.push_back(rootLayer); 358 renderSurfaceLayerList.push_back(rootLayer);
359 } 359 }
360 360
361 // Recursively walks the layer tree starting at the given node and computes all the 361 // Recursively walks the layer tree starting at the given node and computes all the
362 // necessary transformations, clipRects, render surfaces, etc. 362 // necessary transformations, clipRects, render surfaces, etc.
363 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter> 363 template<typename LayerType, typename LayerList, typename RenderSurfaceType, typ ename LayerSorter>
364 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix, 364 static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay er, const WebTransformationMatrix& parentMatrix,
365 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix, 365 const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationM atrix& currentScrollCompensationMatrix,
366 const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, 366 const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree,
367 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList, 367 RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceL ayerList, LayerList& layerList,
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } else { 592 } else {
593 layer->setDrawTransform(drawTransform); 593 layer->setDrawTransform(drawTransform);
594 layer->setDrawTransformIsAnimating(animatingTransformToTarget); 594 layer->setDrawTransformIsAnimating(animatingTransformToTarget);
595 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen); 595 layer->setScreenSpaceTransformIsAnimating(animatingTransformToScreen);
596 sublayerMatrix = combinedTransform; 596 sublayerMatrix = combinedTransform;
597 597
598 layer->setDrawOpacity(drawOpacity); 598 layer->setDrawOpacity(drawOpacity);
599 layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating); 599 layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating);
600 600
601 if (layer != rootLayer) { 601 if (layer != rootLayer) {
602 ASSERT(layer->parent()); 602 DCHECK(layer->parent());
603 layer->clearRenderSurface(); 603 layer->clearRenderSurface();
604 604
605 // Layers without renderSurfaces directly inherit the ancestor's cli p status. 605 // Layers without renderSurfaces directly inherit the ancestor's cli p status.
606 subtreeShouldBeClipped = ancestorClipsSubtree; 606 subtreeShouldBeClipped = ancestorClipsSubtree;
607 if (ancestorClipsSubtree) 607 if (ancestorClipsSubtree)
608 clipRectForSubtree = clipRectFromAncestor; 608 clipRectForSubtree = clipRectFromAncestor;
609 609
610 // Layers that are not their own renderTarget will render into the t arget of their nearest ancestor. 610 // Layers that are not their own renderTarget will render into the t arget of their nearest ancestor.
611 layer->setRenderTarget(layer->parent()->renderTarget()); 611 layer->setRenderTarget(layer->parent()->renderTarget());
612 } else { 612 } else {
613 // FIXME: This root layer special case code should eventually go awa y. https://bugs.webkit.org/show_bug.cgi?id=92290 613 // FIXME: This root layer special case code should eventually go awa y. https://bugs.webkit.org/show_bug.cgi?id=92290
614 ASSERT(!layer->parent()); 614 DCHECK(!layer->parent());
615 ASSERT(layer->renderSurface()); 615 DCHECK(layer->renderSurface());
616 ASSERT(ancestorClipsSubtree); 616 DCHECK(ancestorClipsSubtree);
617 layer->renderSurface()->setClipRect(clipRectFromAncestor); 617 layer->renderSurface()->setClipRect(clipRectFromAncestor);
618 subtreeShouldBeClipped = false; 618 subtreeShouldBeClipped = false;
619 } 619 }
620 } 620 }
621 621
622 IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(laye r->drawTransform(), contentRect)); 622 IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(laye r->drawTransform(), contentRect));
623 623
624 if (layerClipsSubtree(layer)) { 624 if (layerClipsSubtree(layer)) {
625 subtreeShouldBeClipped = true; 625 subtreeShouldBeClipped = true;
626 if (ancestorClipsSubtree && !layer->renderSurface()) { 626 if (ancestorClipsSubtree && !layer->renderSurface()) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 if (!layer->renderSurface()->layerList().size()) { 730 if (!layer->renderSurface()->layerList().size()) {
731 // FIXME: Originally we asserted that this layer was already at the end of the 731 // FIXME: Originally we asserted that this layer was already at the end of the
732 // list, and only needed to remove that layer. For now, we re move the 732 // list, and only needed to remove that layer. For now, we re move the
733 // entire subtree of surfaces to fix a crash bug. The root ca use is 733 // entire subtree of surfaces to fix a crash bug. The root ca use is
734 // https://bugs.webkit.org/show_bug.cgi?id=74147 and we shoul d be able 734 // https://bugs.webkit.org/show_bug.cgi?id=74147 and we shoul d be able
735 // to put the original assert after fixing that. 735 // to put the original assert after fixing that.
736 while (renderSurfaceLayerList.back() != layer) { 736 while (renderSurfaceLayerList.back() != layer) {
737 renderSurfaceLayerList.back()->clearRenderSurface(); 737 renderSurfaceLayerList.back()->clearRenderSurface();
738 renderSurfaceLayerList.pop_back(); 738 renderSurfaceLayerList.pop_back();
739 } 739 }
740 ASSERT(renderSurfaceLayerList.back() == layer); 740 DCHECK(renderSurfaceLayerList.back() == layer);
741 renderSurfaceLayerList.pop_back(); 741 renderSurfaceLayerList.pop_back();
742 layer->clearRenderSurface(); 742 layer->clearRenderSurface();
743 return; 743 return;
744 } 744 }
745 } 745 }
746 746
747 // If neither this layer nor any of its children were added, early out. 747 // If neither this layer nor any of its children were added, early out.
748 if (sortingStartIndex == descendants.size()) 748 if (sortingStartIndex == descendants.size())
749 return; 749 return;
750 750
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 856
857 foundLayer = currentLayer; 857 foundLayer = currentLayer;
858 break; 858 break;
859 } 859 }
860 860
861 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer. 861 // This can potentially return 0, which means the viewportPoint did not succ essfully hit test any layers, not even the root layer.
862 return foundLayer; 862 return foundLayer;
863 } 863 }
864 864
865 } // namespace cc 865 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698