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

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

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Layer GetLayerTree now directly uses LayerTree pointer. Created 4 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
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/animation/element_id.h" 20 #include "cc/animation/element_id.h"
21 #include "cc/animation/target_property.h" 21 #include "cc/animation/target_property.h"
22 #include "cc/base/cc_export.h" 22 #include "cc/base/cc_export.h"
23 #include "cc/base/region.h" 23 #include "cc/base/region.h"
24 #include "cc/debug/micro_benchmark.h" 24 #include "cc/debug/micro_benchmark.h"
25 #include "cc/input/input_handler.h" 25 #include "cc/input/input_handler.h"
26 #include "cc/layers/layer_collections.h" 26 #include "cc/layers/layer_collections.h"
27 #include "cc/layers/layer_position_constraint.h" 27 #include "cc/layers/layer_position_constraint.h"
28 #include "cc/layers/paint_properties.h" 28 #include "cc/layers/paint_properties.h"
29 #include "cc/output/filter_operations.h" 29 #include "cc/output/filter_operations.h"
30 #include "cc/trees/layer_tree.h"
30 #include "cc/trees/mutator_host_client.h" 31 #include "cc/trees/mutator_host_client.h"
31 #include "cc/trees/property_tree.h" 32 #include "cc/trees/property_tree.h"
32 #include "third_party/skia/include/core/SkColor.h" 33 #include "third_party/skia/include/core/SkColor.h"
33 #include "third_party/skia/include/core/SkPicture.h" 34 #include "third_party/skia/include/core/SkPicture.h"
34 #include "third_party/skia/include/core/SkXfermode.h" 35 #include "third_party/skia/include/core/SkXfermode.h"
35 #include "ui/gfx/geometry/point3_f.h" 36 #include "ui/gfx/geometry/point3_f.h"
36 #include "ui/gfx/geometry/rect.h" 37 #include "ui/gfx/geometry/rect.h"
37 #include "ui/gfx/geometry/rect_f.h" 38 #include "ui/gfx/geometry/rect_f.h"
38 #include "ui/gfx/geometry/scroll_offset.h" 39 #include "ui/gfx/geometry/scroll_offset.h"
39 #include "ui/gfx/transform.h" 40 #include "ui/gfx/transform.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // called only on layers that have changed properties. The properties 381 // called only on layers that have changed properties. The properties
381 // themselves are pushed to proto::LayerProperties. 382 // themselves are pushed to proto::LayerProperties.
382 void ToLayerPropertiesProto(proto::LayerUpdate* layer_update); 383 void ToLayerPropertiesProto(proto::LayerUpdate* layer_update);
383 384
384 // Read all property values from the given LayerProperties object and update 385 // Read all property values from the given LayerProperties object and update
385 // the current layer. The values for |needs_push_properties_| and 386 // the current layer. The values for |needs_push_properties_| and
386 // |num_dependents_need_push_properties_| are always updated, but the rest 387 // |num_dependents_need_push_properties_| are always updated, but the rest
387 // of |proto| is only read if |needs_push_properties_| is set. 388 // of |proto| is only read if |needs_push_properties_| is set.
388 void FromLayerPropertiesProto(const proto::LayerProperties& proto); 389 void FromLayerPropertiesProto(const proto::LayerProperties& proto);
389 390
391 // TODO(xingliu): Layer will hold LayerTree instead of LayerTreeHost.
392 // http://crbug.com/628683
390 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } 393 LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
391 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } 394 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
395 LayerTree* GetLayerTree() const;
392 396
393 virtual ScrollbarLayerInterface* ToScrollbarLayer(); 397 virtual ScrollbarLayerInterface* ToScrollbarLayer();
394 398
395 virtual sk_sp<SkPicture> GetPicture() const; 399 virtual sk_sp<SkPicture> GetPicture() const;
396 400
397 // Constructs a LayerImpl of the correct runtime type for this Layer type. 401 // Constructs a LayerImpl of the correct runtime type for this Layer type.
398 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); 402 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
399 403
400 bool NeedsDisplayForTesting() const { return !inputs_.update_rect.IsEmpty(); } 404 bool NeedsDisplayForTesting() const { return !inputs_.update_rect.IsEmpty(); }
401 void ResetNeedsDisplayForTesting() { inputs_.update_rect = gfx::Rect(); } 405 void ResetNeedsDisplayForTesting() { inputs_.update_rect = gfx::Rect(); }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 base::Closure did_scroll_callback; 688 base::Closure did_scroll_callback;
685 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; 689 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests;
686 }; 690 };
687 691
688 Layer* parent_; 692 Layer* parent_;
689 693
690 // Layer instances have a weak pointer to their LayerTreeHost. 694 // Layer instances have a weak pointer to their LayerTreeHost.
691 // This pointer value is nil when a Layer is not in a tree and is 695 // This pointer value is nil when a Layer is not in a tree and is
692 // updated via SetLayerTreeHost() if a layer moves between trees. 696 // updated via SetLayerTreeHost() if a layer moves between trees.
693 LayerTreeHost* layer_tree_host_; 697 LayerTreeHost* layer_tree_host_;
698 LayerTree* layer_tree_;
694 699
695 Inputs inputs_; 700 Inputs inputs_;
696 701
697 int num_descendants_that_draw_content_; 702 int num_descendants_that_draw_content_;
698 int transform_tree_index_; 703 int transform_tree_index_;
699 int effect_tree_index_; 704 int effect_tree_index_;
700 int clip_tree_index_; 705 int clip_tree_index_;
701 int scroll_tree_index_; 706 int scroll_tree_index_;
702 int property_tree_sequence_number_; 707 int property_tree_sequence_number_;
703 gfx::Vector2dF offset_to_transform_parent_; 708 gfx::Vector2dF offset_to_transform_parent_;
(...skipping 17 matching lines...) Expand all
721 // These all act like draw properties, so don't need push properties. 726 // These all act like draw properties, so don't need push properties.
722 gfx::Rect visible_layer_rect_; 727 gfx::Rect visible_layer_rect_;
723 size_t num_unclipped_descendants_; 728 size_t num_unclipped_descendants_;
724 729
725 DISALLOW_COPY_AND_ASSIGN(Layer); 730 DISALLOW_COPY_AND_ASSIGN(Layer);
726 }; 731 };
727 732
728 } // namespace cc 733 } // namespace cc
729 734
730 #endif // CC_LAYERS_LAYER_H_ 735 #endif // CC_LAYERS_LAYER_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/layer.cc » ('j') | cc/proto/layer_tree.proto » ('J')

Powered by Google App Engine
This is Rietveld 408576698