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

Side by Side Diff: Source/core/rendering/RenderLayerCompositor.h

Issue 26110004: Defer the real work in updateCompositingLayers until it's really needed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: few more fixes Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 28 matching lines...) Expand all
39 class RenderPart; 39 class RenderPart;
40 class RenderVideo; 40 class RenderVideo;
41 class ScrollingCoordinator; 41 class ScrollingCoordinator;
42 class StickyPositionViewportConstraints; 42 class StickyPositionViewportConstraints;
43 43
44 44
45 enum CompositingUpdateType { 45 enum CompositingUpdateType {
46 CompositingUpdateAfterStyleChange, 46 CompositingUpdateAfterStyleChange,
47 CompositingUpdateAfterLayout, 47 CompositingUpdateAfterLayout,
48 CompositingUpdateOnScroll, 48 CompositingUpdateOnScroll,
49 CompositingUpdateOnCompositedScroll 49 CompositingUpdateOnCompositedScroll,
50 CompositingUpdateFinishAllDeferredWork
50 }; 51 };
51 52
52 // RenderLayerCompositor manages the hierarchy of 53 // RenderLayerCompositor manages the hierarchy of
53 // composited RenderLayers. It determines which RenderLayers 54 // composited RenderLayers. It determines which RenderLayers
54 // become compositing, and creates and maintains a hierarchy of 55 // become compositing, and creates and maintains a hierarchy of
55 // GraphicsLayers based on the RenderLayer painting order. 56 // GraphicsLayers based on the RenderLayer painting order.
56 // 57 //
57 // There is one RenderLayerCompositor per RenderView. 58 // There is one RenderLayerCompositor per RenderView.
58 59
59 class RenderLayerCompositor : public GraphicsLayerClient { 60 class RenderLayerCompositor : public GraphicsLayerClient {
(...skipping 24 matching lines...) Expand all
84 void setCompositingLayersNeedRebuild(bool needRebuild = true); 85 void setCompositingLayersNeedRebuild(bool needRebuild = true);
85 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRe build; } 86 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRe build; }
86 87
87 // Called when something outside WebKit affects the visible rect (e.g. deleg ated scrolling). Might schedule a layer flush. 88 // Called when something outside WebKit affects the visible rect (e.g. deleg ated scrolling). Might schedule a layer flush.
88 void didChangeVisibleRect(); 89 void didChangeVisibleRect();
89 90
90 // Updating properties required for determining if compositing is necessary. 91 // Updating properties required for determining if compositing is necessary.
91 void updateCompositingRequirementsState(); 92 void updateCompositingRequirementsState();
92 void setNeedsUpdateCompositingRequirementsState() { m_needsUpdateCompositing RequirementsState = true; } 93 void setNeedsUpdateCompositingRequirementsState() { m_needsUpdateCompositing RequirementsState = true; }
93 94
94 // Rebuild the tree of compositing layers 95 // Main entry point for a full update. As needed, this function will compute compositing requirements,
96 // rebuild the composited layer tree, and/or update all the properties assoc aited with each layer of the
97 // composited layer tree.
95 void updateCompositingLayers(CompositingUpdateType, RenderLayer* updateRoot = 0); 98 void updateCompositingLayers(CompositingUpdateType, RenderLayer* updateRoot = 0);
96 99
97 // Update the compositing state of the given layer. Returns true if that sta te changed. 100 // Update the compositing state of the given layer. Returns true if that sta te changed.
98 enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChan geWillRepaintLater }; 101 enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChan geWillRepaintLater };
99 bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = Co mpositingChangeRepaintNow); 102 bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = Co mpositingChangeRepaintNow);
100 103
101 // Update the geometry for compositing children of compositingAncestor. 104 // Update the geometry for compositing children of compositingAncestor.
102 void updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, R enderLayer*, bool compositedChildrenOnly); 105 void updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, R enderLayer*, bool compositedChildrenOnly);
103 106
104 // Whether layer's compositedLayerMapping needs a GraphicsLayer to do clippi ng by an ancestor (non-stacking-context parent with overflow). 107 // Whether layer's compositedLayerMapping needs a GraphicsLayer to do clippi ng by an ancestor (non-stacking-context parent with overflow).
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 195
193 void updateViewportConstraintStatus(RenderLayer*); 196 void updateViewportConstraintStatus(RenderLayer*);
194 void removeViewportConstrainedLayer(RenderLayer*); 197 void removeViewportConstrainedLayer(RenderLayer*);
195 198
196 void addOutOfFlowPositionedLayer(RenderLayer*); 199 void addOutOfFlowPositionedLayer(RenderLayer*);
197 void removeOutOfFlowPositionedLayer(RenderLayer*); 200 void removeOutOfFlowPositionedLayer(RenderLayer*);
198 201
199 void resetTrackedRepaintRects(); 202 void resetTrackedRepaintRects();
200 void setTracksRepaints(bool); 203 void setTracksRepaints(bool);
201 204
202 void setShouldReevaluateCompositingAfterLayout() { m_reevaluateCompositingAf terLayout = true; } 205 void setNeedsToRecomputeCompositingRequirements() { m_needsToRecomputeCompos itingRequirements = true; }
203 206
204 // Returns all reasons (direct, indirectly due to subtree, and indirectly du e to overlap) that a layer should be composited. 207 // Returns all reasons (direct, indirectly due to subtree, and indirectly du e to overlap) that a layer should be composited.
205 CompositingReasons reasonsForCompositing(const RenderLayer*) const; 208 CompositingReasons reasonsForCompositing(const RenderLayer*) const;
206 209
207 virtual String debugName(const GraphicsLayer*) OVERRIDE; 210 virtual String debugName(const GraphicsLayer*) OVERRIDE;
208 211
209 private: 212 private:
210 class OverlapMap; 213 class OverlapMap;
211 214
212 // GraphicsLayerClient implementation 215 // GraphicsLayerClient implementation
(...skipping 17 matching lines...) Expand all
230 bool allocateOrClearCompositedLayerMapping(RenderLayer*, CompositingChangeRe paint shouldRepaint); 233 bool allocateOrClearCompositedLayerMapping(RenderLayer*, CompositingChangeRe paint shouldRepaint);
231 234
232 void clearMappingForRenderLayerIncludingDescendants(RenderLayer*); 235 void clearMappingForRenderLayerIncludingDescendants(RenderLayer*);
233 236
234 // Repaint the given rect (which is layer's coords), and regions of child la yers that intersect that rect. 237 // Repaint the given rect (which is layer's coords), and regions of child la yers that intersect that rect.
235 void recursiveRepaintLayer(RenderLayer*, const IntRect* = 0); 238 void recursiveRepaintLayer(RenderLayer*, const IntRect* = 0);
236 239
237 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed); 240 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed);
238 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancest orLayer = 0); 241 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancest orLayer = 0);
239 242
243 // Forces an update for all frames of frame tree recursively. Used only when the mainFrame compositor is ready to
244 // finish all deferred work.
245 static void finishCompositingUpdateForFrameTree(Frame*);
246
240 // Returns true if any layer's compositing changed 247 // Returns true if any layer's compositing changed
241 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* , OverlapMap*, struct CompositingRecursionData&, bool& layersChanged, bool& desc endantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants); 248 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* , OverlapMap*, struct CompositingRecursionData&, bool& layersChanged, bool& desc endantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants);
242 249
243 // Recurses down the tree, parenting descendant compositing layers and colle cting an array of child layers for the current compositing layer. 250 // Recurses down the tree, parenting descendant compositing layers and colle cting an array of child layers for the current compositing layer.
244 void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& child GraphicsLayersOfEnclosingLayer, int depth); 251 void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& child GraphicsLayersOfEnclosingLayer, int depth);
245 252
246 // Recurses down the tree, updating layer geometry only. 253 // Recurses down the tree, updating layer geometry only.
247 void updateLayerTreeGeometry(RenderLayer*, int depth); 254 void updateLayerTreeGeometry(RenderLayer*, int depth);
248 255
249 // Hook compositing layers together 256 // Hook compositing layers together
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 private: 317 private:
311 RenderView* m_renderView; 318 RenderView* m_renderView;
312 OwnPtr<GraphicsLayer> m_rootContentLayer; 319 OwnPtr<GraphicsLayer> m_rootContentLayer;
313 320
314 bool m_hasAcceleratedCompositing; 321 bool m_hasAcceleratedCompositing;
315 ChromeClient::CompositingTriggerFlags m_compositingTriggers; 322 ChromeClient::CompositingTriggerFlags m_compositingTriggers;
316 323
317 int m_compositedLayerCount; 324 int m_compositedLayerCount;
318 bool m_showRepaintCounter; 325 bool m_showRepaintCounter;
319 326
320 // When true, we have to wait until layout has happened before we can decide whether to enter compositing mode, 327 // FIXME: This should absolutely not be mutable.
321 // because only then do we know the final size of plugins and iframes. 328 mutable bool m_needsToRecomputeCompositingRequirements;
322 mutable bool m_reevaluateCompositingAfterLayout; 329 bool m_needsToUpdateLayerTreeGeometry;
323 330
324 bool m_compositing; 331 bool m_compositing;
325 bool m_compositingLayersNeedRebuild; 332 bool m_compositingLayersNeedRebuild;
326 bool m_forceCompositingMode; 333 bool m_forceCompositingMode;
327 bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions) 334 bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions)
328 bool m_needsUpdateCompositingRequirementsState; 335 bool m_needsUpdateCompositingRequirementsState;
329 336
330 bool m_isTrackingRepaints; // Used for testing. 337 bool m_isTrackingRepaints; // Used for testing.
331 338
332 RootLayerAttachment m_rootLayerAttachment; 339 RootLayerAttachment m_rootLayerAttachment;
(...skipping 27 matching lines...) Expand all
360 int m_secondaryCompositedLayerCount; // count of layers that have to be comp osited because of stacking or overlap. 367 int m_secondaryCompositedLayerCount; // count of layers that have to be comp osited because of stacking or overlap.
361 double m_obligatoryBackingStoreBytes; 368 double m_obligatoryBackingStoreBytes;
362 double m_secondaryBackingStoreBytes; 369 double m_secondaryBackingStoreBytes;
363 #endif 370 #endif
364 }; 371 };
365 372
366 373
367 } // namespace WebCore 374 } // namespace WebCore
368 375
369 #endif // RenderLayerCompositor_h 376 #endif // RenderLayerCompositor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698