Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/filter_operations.h" | 20 #include "cc/base/filter_operations.h" |
| 21 #include "cc/base/region.h" | 21 #include "cc/base/region.h" |
| 22 #include "cc/benchmarks/micro_benchmark.h" | 22 #include "cc/benchmarks/micro_benchmark.h" |
| 23 #include "cc/cc_export.h" | 23 #include "cc/cc_export.h" |
| 24 #include "cc/input/input_handler.h" | 24 #include "cc/input/input_handler.h" |
| 25 #include "cc/layers/layer_collections.h" | 25 #include "cc/layers/layer_collections.h" |
| 26 #include "cc/layers/layer_position_constraint.h" | 26 #include "cc/layers/layer_position_constraint.h" |
| 27 #include "cc/paint/paint_record.h" | 27 #include "cc/paint/paint_record.h" |
| 28 #include "cc/surfaces/surface_id.h" | |
| 28 #include "cc/trees/element_id.h" | 29 #include "cc/trees/element_id.h" |
| 29 #include "cc/trees/mutator_host_client.h" | 30 #include "cc/trees/mutator_host_client.h" |
| 30 #include "cc/trees/property_tree.h" | 31 #include "cc/trees/property_tree.h" |
| 31 #include "cc/trees/target_property.h" | 32 #include "cc/trees/target_property.h" |
| 32 #include "third_party/skia/include/core/SkColor.h" | 33 #include "third_party/skia/include/core/SkColor.h" |
| 33 #include "ui/gfx/geometry/point3_f.h" | 34 #include "ui/gfx/geometry/point3_f.h" |
| 34 #include "ui/gfx/geometry/rect.h" | 35 #include "ui/gfx/geometry/rect.h" |
| 35 #include "ui/gfx/geometry/rect_f.h" | 36 #include "ui/gfx/geometry/rect_f.h" |
| 36 #include "ui/gfx/geometry/scroll_offset.h" | 37 #include "ui/gfx/geometry/scroll_offset.h" |
| 37 #include "ui/gfx/transform.h" | 38 #include "ui/gfx/transform.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 virtual bool IsSuitableForGpuRasterization() const; | 307 virtual bool IsSuitableForGpuRasterization() const; |
| 307 | 308 |
| 308 virtual std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 309 virtual std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 309 TakeDebugInfo(); | 310 TakeDebugInfo(); |
| 310 virtual void didUpdateMainThreadScrollingReasons(); | 311 virtual void didUpdateMainThreadScrollingReasons(); |
| 311 | 312 |
| 312 void SetLayerClient(LayerClient* client) { inputs_.client = client; } | 313 void SetLayerClient(LayerClient* client) { inputs_.client = client; } |
| 313 | 314 |
| 314 virtual bool IsSnapped(); | 315 virtual bool IsSnapped(); |
| 315 | 316 |
| 317 virtual bool IsSurfaceLayer() const; | |
|
enne (OOO)
2017/05/19 22:27:05
I'm not really that keen on virtuals that say what
jaydasika
2017/05/23 00:25:14
(2) done
| |
| 318 | |
| 319 virtual const SurfaceId* GetSurfaceId() const; | |
| 320 | |
| 316 virtual void PushPropertiesTo(LayerImpl* layer); | 321 virtual void PushPropertiesTo(LayerImpl* layer); |
| 317 | 322 |
| 318 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } | 323 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } |
| 319 | 324 |
| 320 virtual ScrollbarLayerInterface* ToScrollbarLayer(); | 325 virtual ScrollbarLayerInterface* ToScrollbarLayer(); |
| 321 | 326 |
| 322 virtual sk_sp<SkPicture> GetPicture() const; | 327 virtual sk_sp<SkPicture> GetPicture() const; |
| 323 | 328 |
| 324 // Constructs a LayerImpl of the correct runtime type for this Layer type. | 329 // Constructs a LayerImpl of the correct runtime type for this Layer type. |
| 325 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); | 330 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 void set_should_flatten_transform_from_property_tree(bool should_flatten) { | 375 void set_should_flatten_transform_from_property_tree(bool should_flatten) { |
| 371 if (should_flatten_transform_from_property_tree_ == should_flatten) | 376 if (should_flatten_transform_from_property_tree_ == should_flatten) |
| 372 return; | 377 return; |
| 373 should_flatten_transform_from_property_tree_ = should_flatten; | 378 should_flatten_transform_from_property_tree_ = should_flatten; |
| 374 SetNeedsPushProperties(); | 379 SetNeedsPushProperties(); |
| 375 } | 380 } |
| 376 bool should_flatten_transform_from_property_tree() const { | 381 bool should_flatten_transform_from_property_tree() const { |
| 377 return should_flatten_transform_from_property_tree_; | 382 return should_flatten_transform_from_property_tree_; |
| 378 } | 383 } |
| 379 | 384 |
| 385 void SetIsHidden(bool is_hidden); | |
| 386 | |
| 387 bool is_hidden() const { return is_hidden_; } | |
| 388 | |
| 380 const gfx::Rect& visible_layer_rect_for_testing() const { | 389 const gfx::Rect& visible_layer_rect_for_testing() const { |
| 381 return visible_layer_rect_; | 390 return visible_layer_rect_; |
| 382 } | 391 } |
| 383 void set_visible_layer_rect(const gfx::Rect& rect) { | 392 void set_visible_layer_rect(const gfx::Rect& rect) { |
| 384 visible_layer_rect_ = rect; | 393 visible_layer_rect_ = rect; |
| 385 } | 394 } |
| 386 | 395 |
| 387 // This is for tracking damage. | 396 // This is for tracking damage. |
| 388 void SetSubtreePropertyChanged(); | 397 void SetSubtreePropertyChanged(); |
| 389 bool subtree_property_changed() const { return subtree_property_changed_; } | 398 bool subtree_property_changed() const { return subtree_property_changed_; } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 | 615 |
| 607 int num_descendants_that_draw_content_; | 616 int num_descendants_that_draw_content_; |
| 608 int transform_tree_index_; | 617 int transform_tree_index_; |
| 609 int effect_tree_index_; | 618 int effect_tree_index_; |
| 610 int clip_tree_index_; | 619 int clip_tree_index_; |
| 611 int scroll_tree_index_; | 620 int scroll_tree_index_; |
| 612 int property_tree_sequence_number_; | 621 int property_tree_sequence_number_; |
| 613 gfx::Vector2dF offset_to_transform_parent_; | 622 gfx::Vector2dF offset_to_transform_parent_; |
| 614 bool should_flatten_transform_from_property_tree_ : 1; | 623 bool should_flatten_transform_from_property_tree_ : 1; |
| 615 bool draws_content_ : 1; | 624 bool draws_content_ : 1; |
| 625 bool is_hidden_ : 1; | |
| 616 bool use_local_transform_for_backface_visibility_ : 1; | 626 bool use_local_transform_for_backface_visibility_ : 1; |
| 617 bool should_check_backface_visibility_ : 1; | 627 bool should_check_backface_visibility_ : 1; |
| 618 bool force_render_surface_for_testing_ : 1; | 628 bool force_render_surface_for_testing_ : 1; |
| 619 bool subtree_property_changed_ : 1; | 629 bool subtree_property_changed_ : 1; |
| 620 bool may_contain_video_ : 1; | 630 bool may_contain_video_ : 1; |
| 621 bool is_scroll_clip_layer_ : 1; | 631 bool is_scroll_clip_layer_ : 1; |
| 622 bool needs_show_scrollbars_ : 1; | 632 bool needs_show_scrollbars_ : 1; |
| 623 // This value is valid only when LayerTreeHost::has_copy_request() is true | 633 // This value is valid only when LayerTreeHost::has_copy_request() is true |
| 624 bool subtree_has_copy_request_ : 1; | 634 bool subtree_has_copy_request_ : 1; |
| 625 SkColor safe_opaque_background_color_; | 635 SkColor safe_opaque_background_color_; |
| 626 std::unique_ptr<std::set<Layer*>> scroll_children_; | 636 std::unique_ptr<std::set<Layer*>> scroll_children_; |
| 627 | 637 |
| 628 std::unique_ptr<std::set<Layer*>> clip_children_; | 638 std::unique_ptr<std::set<Layer*>> clip_children_; |
| 629 | 639 |
| 630 // These all act like draw properties, so don't need push properties. | 640 // These all act like draw properties, so don't need push properties. |
| 631 gfx::Rect visible_layer_rect_; | 641 gfx::Rect visible_layer_rect_; |
| 632 size_t num_unclipped_descendants_; | 642 size_t num_unclipped_descendants_; |
| 633 | 643 |
| 634 DISALLOW_COPY_AND_ASSIGN(Layer); | 644 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 635 }; | 645 }; |
| 636 | 646 |
| 637 } // namespace cc | 647 } // namespace cc |
| 638 | 648 |
| 639 #endif // CC_LAYERS_LAYER_H_ | 649 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |