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

Side by Side Diff: cc/layers/layer.h

Issue 2661523003: cc: Merge LayerTree into the LayerTreeHost. (Closed)
Patch Set: .. Created 3 years, 11 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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 #ifndef CC_LAYERS_LAYER_H_ 5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_ 6 #define CC_LAYERS_LAYER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <unordered_map> 13 #include <unordered_map>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "cc/base/cc_export.h" 20 #include "cc/base/cc_export.h"
21 #include "cc/base/region.h" 21 #include "cc/base/region.h"
22 #include "cc/debug/micro_benchmark.h" 22 #include "cc/debug/micro_benchmark.h"
23 #include "cc/input/input_handler.h" 23 #include "cc/input/input_handler.h"
24 #include "cc/layers/layer_collections.h" 24 #include "cc/layers/layer_collections.h"
25 #include "cc/layers/layer_position_constraint.h" 25 #include "cc/layers/layer_position_constraint.h"
26 #include "cc/layers/paint_properties.h" 26 #include "cc/layers/paint_properties.h"
27 #include "cc/output/filter_operations.h" 27 #include "cc/output/filter_operations.h"
28 #include "cc/trees/element_id.h" 28 #include "cc/trees/element_id.h"
29 #include "cc/trees/layer_tree.h"
30 #include "cc/trees/mutator_host_client.h" 29 #include "cc/trees/mutator_host_client.h"
31 #include "cc/trees/property_tree.h" 30 #include "cc/trees/property_tree.h"
32 #include "cc/trees/target_property.h" 31 #include "cc/trees/target_property.h"
33 #include "third_party/skia/include/core/SkColor.h" 32 #include "third_party/skia/include/core/SkColor.h"
34 #include "third_party/skia/include/core/SkPicture.h" 33 #include "third_party/skia/include/core/SkPicture.h"
35 #include "ui/gfx/geometry/point3_f.h" 34 #include "ui/gfx/geometry/point3_f.h"
36 #include "ui/gfx/geometry/rect.h" 35 #include "ui/gfx/geometry/rect.h"
37 #include "ui/gfx/geometry/rect_f.h" 36 #include "ui/gfx/geometry/rect_f.h"
38 #include "ui/gfx/geometry/scroll_offset.h" 37 #include "ui/gfx/geometry/scroll_offset.h"
39 #include "ui/gfx/transform.h" 38 #include "ui/gfx/transform.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 TakeDebugInfo(); 318 TakeDebugInfo();
320 virtual void didUpdateMainThreadScrollingReasons(); 319 virtual void didUpdateMainThreadScrollingReasons();
321 320
322 void SetLayerClient(LayerClient* client) { inputs_.client = client; } 321 void SetLayerClient(LayerClient* client) { inputs_.client = client; }
323 322
324 virtual bool IsSnapped(); 323 virtual bool IsSnapped();
325 324
326 virtual void PushPropertiesTo(LayerImpl* layer); 325 virtual void PushPropertiesTo(LayerImpl* layer);
327 326
328 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } 327 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; }
329 LayerTree* GetLayerTree() const;
330 328
331 virtual ScrollbarLayerInterface* ToScrollbarLayer(); 329 virtual ScrollbarLayerInterface* ToScrollbarLayer();
332 330
333 virtual sk_sp<SkPicture> GetPicture() const; 331 virtual sk_sp<SkPicture> GetPicture() const;
334 332
335 // Constructs a LayerImpl of the correct runtime type for this Layer type. 333 // Constructs a LayerImpl of the correct runtime type for this Layer type.
336 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); 334 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
337 335
338 bool NeedsDisplayForTesting() const { return !inputs_.update_rect.IsEmpty(); } 336 bool NeedsDisplayForTesting() const { return !inputs_.update_rect.IsEmpty(); }
339 void ResetNeedsDisplayForTesting() { inputs_.update_rect = gfx::Rect(); } 337 void ResetNeedsDisplayForTesting() { inputs_.update_rect = gfx::Rect(); }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 void ClearPreferredRasterBounds(); 432 void ClearPreferredRasterBounds();
435 433
436 MutatorHost* GetMutatorHost() const; 434 MutatorHost* GetMutatorHost() const;
437 435
438 ElementListType GetElementTypeForAnimation() const; 436 ElementListType GetElementTypeForAnimation() const;
439 437
440 void SetScrollbarsHiddenFromImplSide(bool hidden); 438 void SetScrollbarsHiddenFromImplSide(bool hidden);
441 439
442 const gfx::Rect& update_rect() const { return inputs_.update_rect; } 440 const gfx::Rect& update_rect() const { return inputs_.update_rect; }
443 441
442 LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
danakj 2017/01/27 17:25:09 There used to be this: LayerTreeHost* layer_tr
Khushal 2017/01/27 18:52:19 Nah, I don't think the const one is used anymore.
443
444 protected: 444 protected:
445 friend class LayerImpl; 445 friend class LayerImpl;
446 friend class TreeSynchronizer; 446 friend class TreeSynchronizer;
447 virtual ~Layer(); 447 virtual ~Layer();
448 Layer(); 448 Layer();
449 449
450 LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
451
452 // These SetNeeds functions are in order of severity of update: 450 // These SetNeeds functions are in order of severity of update:
453 // 451 //
454 // Called when this layer has been modified in some way, but isn't sure 452 // Called when this layer has been modified in some way, but isn't sure
455 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers 453 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers
456 // before it knows whether or not a commit is required. 454 // before it knows whether or not a commit is required.
457 void SetNeedsUpdate(); 455 void SetNeedsUpdate();
458 // Called when a property has been modified in a way that the layer 456 // Called when a property has been modified in a way that the layer
459 // knows immediately that a commit is required. This implies SetNeedsUpdate 457 // knows immediately that a commit is required. This implies SetNeedsUpdate
460 // as well as SetNeedsPushProperties to push that property. 458 // as well as SetNeedsPushProperties to push that property.
461 void SetNeedsCommit(); 459 void SetNeedsCommit();
(...skipping 19 matching lines...) Expand all
481 479
482 bool IsPropertyChangeAllowed() const; 480 bool IsPropertyChangeAllowed() const;
483 481
484 // When true, the layer is about to perform an update. Any commit requests 482 // When true, the layer is about to perform an update. Any commit requests
485 // will be handled implicitly after the update completes. 483 // will be handled implicitly after the update completes.
486 bool ignore_set_needs_commit_; 484 bool ignore_set_needs_commit_;
487 485
488 private: 486 private:
489 friend class base::RefCounted<Layer>; 487 friend class base::RefCounted<Layer>;
490 friend class LayerTreeHostCommon; 488 friend class LayerTreeHostCommon;
491 friend class LayerTree; 489 friend class LayerTreeHost;
492 friend class LayerInternalsForTest; 490 friend class LayerInternalsForTest;
493 491
494 // Interactions with attached animations. 492 // Interactions with attached animations.
495 gfx::ScrollOffset ScrollOffsetForAnimation() const; 493 gfx::ScrollOffset ScrollOffsetForAnimation() const;
496 void OnFilterAnimated(const FilterOperations& filters); 494 void OnFilterAnimated(const FilterOperations& filters);
497 void OnOpacityAnimated(float opacity); 495 void OnOpacityAnimated(float opacity);
498 void OnTransformAnimated(const gfx::Transform& transform); 496 void OnTransformAnimated(const gfx::Transform& transform);
499 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset); 497 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset);
500 498
501 void OnIsAnimatingChanged(const PropertyAnimationState& mask, 499 void OnIsAnimatingChanged(const PropertyAnimationState& mask,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 619
622 gfx::Size preferred_raster_bounds; 620 gfx::Size preferred_raster_bounds;
623 }; 621 };
624 622
625 Layer* parent_; 623 Layer* parent_;
626 624
627 // Layer instances have a weak pointer to their LayerTreeHost. 625 // Layer instances have a weak pointer to their LayerTreeHost.
628 // This pointer value is nil when a Layer is not in a tree and is 626 // This pointer value is nil when a Layer is not in a tree and is
629 // updated via SetLayerTreeHost() if a layer moves between trees. 627 // updated via SetLayerTreeHost() if a layer moves between trees.
630 LayerTreeHost* layer_tree_host_; 628 LayerTreeHost* layer_tree_host_;
631 LayerTree* layer_tree_;
632 629
633 Inputs inputs_; 630 Inputs inputs_;
634 631
635 int num_descendants_that_draw_content_; 632 int num_descendants_that_draw_content_;
636 int transform_tree_index_; 633 int transform_tree_index_;
637 int effect_tree_index_; 634 int effect_tree_index_;
638 int clip_tree_index_; 635 int clip_tree_index_;
639 int scroll_tree_index_; 636 int scroll_tree_index_;
640 int property_tree_sequence_number_; 637 int property_tree_sequence_number_;
641 gfx::Vector2dF offset_to_transform_parent_; 638 gfx::Vector2dF offset_to_transform_parent_;
(...skipping 17 matching lines...) Expand all
659 // These all act like draw properties, so don't need push properties. 656 // These all act like draw properties, so don't need push properties.
660 gfx::Rect visible_layer_rect_; 657 gfx::Rect visible_layer_rect_;
661 size_t num_unclipped_descendants_; 658 size_t num_unclipped_descendants_;
662 659
663 DISALLOW_COPY_AND_ASSIGN(Layer); 660 DISALLOW_COPY_AND_ASSIGN(Layer);
664 }; 661 };
665 662
666 } // namespace cc 663 } // namespace cc
667 664
668 #endif // CC_LAYERS_LAYER_H_ 665 #endif // CC_LAYERS_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698