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

Side by Side Diff: Source/core/platform/graphics/GraphicsLayer.h

Issue 23050018: DevTools: expose layer compositing reasons and paint count via layer tree agent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer Client*); 212 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer Client*);
213 213
214 virtual ~GraphicsLayer(); 214 virtual ~GraphicsLayer();
215 215
216 GraphicsLayerClient* client() const { return m_client; } 216 GraphicsLayerClient* client() const { return m_client; }
217 217
218 // WebKit::WebLayerClient implementation. 218 // WebKit::WebLayerClient implementation.
219 virtual WebKit::WebString debugName(WebKit::WebLayer*) OVERRIDE; 219 virtual WebKit::WebString debugName(WebKit::WebLayer*) OVERRIDE;
220 220
221 void setCompositingReasons(WebKit::WebCompositingReasons); 221 void setCompositingReasons(WebKit::WebCompositingReasons);
222 WebKit::WebCompositingReasons compositingReasons() const { return m_composit ingReasons; }
222 223
223 GraphicsLayer* parent() const { return m_parent; }; 224 GraphicsLayer* parent() const { return m_parent; };
224 void setParent(GraphicsLayer*); // Internal use only. 225 void setParent(GraphicsLayer*); // Internal use only.
225 226
226 // Returns true if the layer has the given layer as an ancestor (excluding s elf). 227 // Returns true if the layer has the given layer as an ancestor (excluding s elf).
227 bool hasAncestor(GraphicsLayer*) const; 228 bool hasAncestor(GraphicsLayer*) const;
228 229
229 const Vector<GraphicsLayer*>& children() const { return m_children; } 230 const Vector<GraphicsLayer*>& children() const { return m_children; }
230 // Returns true if the child list changed. 231 // Returns true if the child list changed.
231 bool setChildren(const Vector<GraphicsLayer*>&); 232 bool setChildren(const Vector<GraphicsLayer*>&);
(...skipping 10 matching lines...) Expand all
242 243
243 GraphicsLayer* maskLayer() const { return m_maskLayer; } 244 GraphicsLayer* maskLayer() const { return m_maskLayer; }
244 void setMaskLayer(GraphicsLayer*); 245 void setMaskLayer(GraphicsLayer*);
245 246
246 // The given layer will replicate this layer and its children; the replica r enders behind this layer. 247 // The given layer will replicate this layer and its children; the replica r enders behind this layer.
247 void setReplicatedByLayer(GraphicsLayer*); 248 void setReplicatedByLayer(GraphicsLayer*);
248 // Whether this layer is being replicated by another layer. 249 // Whether this layer is being replicated by another layer.
249 bool isReplicated() const { return m_replicaLayer; } 250 bool isReplicated() const { return m_replicaLayer; }
250 // The layer that replicates this layer (if any). 251 // The layer that replicates this layer (if any).
251 GraphicsLayer* replicaLayer() const { return m_replicaLayer; } 252 GraphicsLayer* replicaLayer() const { return m_replicaLayer; }
253 // The layer being replicated.
254 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; }
252 255
253 const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayer Position; } 256 const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayer Position; }
254 void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosi tion = p; } 257 void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosi tion = p; }
255 258
256 enum ShouldSetNeedsDisplay { 259 enum ShouldSetNeedsDisplay {
257 DontSetNeedsDisplay, 260 DontSetNeedsDisplay,
258 SetNeedsDisplay 261 SetNeedsDisplay
259 }; 262 };
260 263
261 // Offset is origin of the renderer minus origin of the graphics layer (so e ither zero or negative). 264 // Offset is origin of the renderer minus origin of the graphics layer (so e ither zero or negative).
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 WebKit::WebLayer* platformLayer() const; 370 WebKit::WebLayer* platformLayer() const;
368 371
369 enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, Comp ositingCoordinatesBottomUp }; 372 enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, Comp ositingCoordinatesBottomUp };
370 373
371 // Flippedness of the contents of this layer. Does not affect sublayer geome try. 374 // Flippedness of the contents of this layer. Does not affect sublayer geome try.
372 void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; } 375 void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
373 CompositingCoordinatesOrientation contentsOrientation() const { return m_con tentsOrientation; } 376 CompositingCoordinatesOrientation contentsOrientation() const { return m_con tentsOrientation; }
374 377
375 void dumpLayer(TextStream&, int indent = 0, LayerTreeFlags = LayerTreeNormal ) const; 378 void dumpLayer(TextStream&, int indent = 0, LayerTreeFlags = LayerTreeNormal ) const;
376 379
377 void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; } 380 int paintCount() const { return m_paintCount; }
pfeldman 2013/08/22 16:49:54 Why is this going away?
378 bool isShowingRepaintCounter() const { return m_showRepaintCounter; }
379
380 // FIXME: this is really a paint count.
381 int repaintCount() const { return m_repaintCount; }
382 int incrementRepaintCount() { return ++m_repaintCount; }
383 381
384 // z-position is the z-equivalent of position(). It's only used for debuggin g purposes. 382 // z-position is the z-equivalent of position(). It's only used for debuggin g purposes.
385 float zPosition() const { return m_zPosition; } 383 float zPosition() const { return m_zPosition; }
386 void setZPosition(float); 384 void setZPosition(float);
387 385
388 void distributeOpacity(float); 386 void distributeOpacity(float);
389 float accumulatedOpacity() const; 387 float accumulatedOpacity() const;
390 388
391 // If the exposed rect of this layer changes, returns true if this or descen dant layers need a flush, 389 // If the exposed rect of this layer changes, returns true if this or descen dant layers need a flush,
392 // for example to allocate new tiles. 390 // for example to allocate new tiles.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // Given a KeyframeValueList containing filterOperations, return true if the operations are valid. 443 // Given a KeyframeValueList containing filterOperations, return true if the operations are valid.
446 static int validateFilterOperations(const KeyframeValueList&); 444 static int validateFilterOperations(const KeyframeValueList&);
447 445
448 // Given a list of TransformAnimationValues, see if all the operations for e ach keyframe match. If so 446 // Given a list of TransformAnimationValues, see if all the operations for e ach keyframe match. If so
449 // return the index of the KeyframeValueList entry that has that list of ope rations (it may not be 447 // return the index of the KeyframeValueList entry that has that list of ope rations (it may not be
450 // the first entry because some keyframes might have an empty transform and those match any list). 448 // the first entry because some keyframes might have an empty transform and those match any list).
451 // If the lists don't match return -1. On return, if hasBigRotation is true, functions contain 449 // If the lists don't match return -1. On return, if hasBigRotation is true, functions contain
452 // rotations of >= 180 degrees 450 // rotations of >= 180 degrees
453 static int validateTransformOperations(const KeyframeValueList&, bool& hasBi gRotation); 451 static int validateTransformOperations(const KeyframeValueList&, bool& hasBi gRotation);
454 452
455 // The layer being replicated.
456 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; }
457 void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; } 453 void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; }
458 454
455 int incrementPaintCount() { return ++m_paintCount; }
456
459 // Any factory classes that want to create a GraphicsLayer need to be friend s. 457 // Any factory classes that want to create a GraphicsLayer need to be friend s.
460 friend class WebKit::GraphicsLayerFactoryChromium; 458 friend class WebKit::GraphicsLayerFactoryChromium;
461 explicit GraphicsLayer(GraphicsLayerClient*); 459 explicit GraphicsLayer(GraphicsLayerClient*);
462 460
463 static void writeIndent(TextStream&, int indent); 461 static void writeIndent(TextStream&, int indent);
464 462
465 void dumpProperties(TextStream&, int indent, LayerTreeFlags) const; 463 void dumpProperties(TextStream&, int indent, LayerTreeFlags) const;
466 void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) c onst { } 464 void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) c onst { }
467 465
468 // Helper functions used by settors to keep layer's the state consistent. 466 // Helper functions used by settors to keep layer's the state consistent.
(...skipping 25 matching lines...) Expand all
494 float m_zPosition; 492 float m_zPosition;
495 493
496 FilterOperations m_filters; 494 FilterOperations m_filters;
497 495
498 bool m_contentsOpaque : 1; 496 bool m_contentsOpaque : 1;
499 bool m_preserves3D: 1; 497 bool m_preserves3D: 1;
500 bool m_backfaceVisibility : 1; 498 bool m_backfaceVisibility : 1;
501 bool m_masksToBounds : 1; 499 bool m_masksToBounds : 1;
502 bool m_drawsContent : 1; 500 bool m_drawsContent : 1;
503 bool m_contentsVisible : 1; 501 bool m_contentsVisible : 1;
504 bool m_showRepaintCounter : 1;
505 502
506 GraphicsLayerPaintingPhase m_paintingPhase; 503 GraphicsLayerPaintingPhase m_paintingPhase;
507 CompositingCoordinatesOrientation m_contentsOrientation; // affects orientat ion of layer contents 504 CompositingCoordinatesOrientation m_contentsOrientation; // affects orientat ion of layer contents
508 505
509 Vector<GraphicsLayer*> m_children; 506 Vector<GraphicsLayer*> m_children;
510 GraphicsLayer* m_parent; 507 GraphicsLayer* m_parent;
511 508
512 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. 509 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this.
513 510
514 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We onl y allow one, for now. 511 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We onl y allow one, for now.
515 // The replica is not parented; this is the p rimary reference to it. 512 // The replica is not parented; this is the p rimary reference to it.
516 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the original layer. 513 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the original layer.
517 FloatPoint m_replicatedLayerPosition; // For a replica layer, the position o f the replica. 514 FloatPoint m_replicatedLayerPosition; // For a replica layer, the position o f the replica.
518 515
519 IntRect m_contentsRect; 516 IntRect m_contentsRect;
520 517
521 int m_repaintCount; 518 int m_paintCount;
522 519
523 Color m_contentsSolidColor; 520 Color m_contentsSolidColor;
524 521
525 OwnPtr<WebKit::WebContentLayer> m_layer; 522 OwnPtr<WebKit::WebContentLayer> m_layer;
526 OwnPtr<WebKit::WebImageLayer> m_imageLayer; 523 OwnPtr<WebKit::WebImageLayer> m_imageLayer;
527 OwnPtr<WebKit::WebSolidColorLayer> m_contentsSolidColorLayer; 524 OwnPtr<WebKit::WebSolidColorLayer> m_contentsSolidColorLayer;
528 WebKit::WebLayer* m_contentsLayer; 525 WebKit::WebLayer* m_contentsLayer;
529 // We don't have ownership of m_contentsLayer, but we do want to know if a g iven layer is the 526 // We don't have ownership of m_contentsLayer, but we do want to know if a g iven layer is the
530 // same as our current layer in setContentsTo(). Since m_contentsLayer may b e deleted at this point, 527 // same as our current layer in setContentsTo(). Since m_contentsLayer may b e deleted at this point,
531 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point 528 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point
532 // on. 529 // on.
533 int m_contentsLayerId; 530 int m_contentsLayerId;
534 531
535 LinkHighlightClient* m_linkHighlight; 532 LinkHighlightClient* m_linkHighlight;
536 533
537 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate; 534 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate;
538 535
539 ContentsLayerPurpose m_contentsLayerPurpose; 536 ContentsLayerPurpose m_contentsLayerPurpose;
540 bool m_inSetChildren; 537 bool m_inSetChildren;
541 538
542 typedef HashMap<String, int> AnimationIdMap; 539 typedef HashMap<String, int> AnimationIdMap;
543 AnimationIdMap m_animationIdMap; 540 AnimationIdMap m_animationIdMap;
544 541
545 ScrollableArea* m_scrollableArea; 542 ScrollableArea* m_scrollableArea;
543 WebKit::WebCompositingReasons m_compositingReasons;
546 }; 544 };
547 545
548 546
549 } // namespace WebCore 547 } // namespace WebCore
550 548
551 #ifndef NDEBUG 549 #ifndef NDEBUG
552 // Outside the WebCore namespace for ease of invocation from gdb. 550 // Outside the WebCore namespace for ease of invocation from gdb.
553 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); 551 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer);
554 #endif 552 #endif
555 553
556 #endif // GraphicsLayer_h 554 #endif // GraphicsLayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698