| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_IMPL_H_ | 5 #ifndef CC_LAYERS_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_LAYER_IMPL_H_ | 6 #define CC_LAYERS_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "cc/animation/animation_delegate.h" | 16 #include "cc/animation/animation_delegate.h" |
| 16 #include "cc/animation/layer_animation_controller.h" | 17 #include "cc/animation/layer_animation_controller.h" |
| 17 #include "cc/animation/layer_animation_value_observer.h" | 18 #include "cc/animation/layer_animation_value_observer.h" |
| 18 #include "cc/animation/layer_animation_value_provider.h" | 19 #include "cc/animation/layer_animation_value_provider.h" |
| 19 #include "cc/base/cc_export.h" | 20 #include "cc/base/cc_export.h" |
| 20 #include "cc/base/region.h" | 21 #include "cc/base/region.h" |
| 21 #include "cc/base/scoped_ptr_vector.h" | 22 #include "cc/base/scoped_ptr_vector.h" |
| 22 #include "cc/base/synced_property.h" | 23 #include "cc/base/synced_property.h" |
| 23 #include "cc/debug/frame_timing_request.h" | 24 #include "cc/debug/frame_timing_request.h" |
| 24 #include "cc/input/input_handler.h" | 25 #include "cc/input/input_handler.h" |
| 25 #include "cc/input/scrollbar.h" | 26 #include "cc/input/scrollbar.h" |
| 26 #include "cc/layers/draw_properties.h" | 27 #include "cc/layers/draw_properties.h" |
| 27 #include "cc/layers/layer_lists.h" | 28 #include "cc/layers/layer_lists.h" |
| 28 #include "cc/layers/layer_position_constraint.h" | 29 #include "cc/layers/layer_position_constraint.h" |
| 29 #include "cc/layers/render_surface_impl.h" | 30 #include "cc/layers/render_surface_impl.h" |
| 30 #include "cc/layers/scroll_blocks_on.h" | 31 #include "cc/layers/scroll_blocks_on.h" |
| 31 #include "cc/output/filter_operations.h" | 32 #include "cc/output/filter_operations.h" |
| 32 #include "cc/quads/shared_quad_state.h" | 33 #include "cc/quads/shared_quad_state.h" |
| 33 #include "cc/resources/resource_provider.h" | 34 #include "cc/resources/resource_provider.h" |
| 35 #include "cc/resources/tile_priority.h" |
| 34 #include "skia/ext/refptr.h" | 36 #include "skia/ext/refptr.h" |
| 35 #include "third_party/skia/include/core/SkColor.h" | 37 #include "third_party/skia/include/core/SkColor.h" |
| 36 #include "third_party/skia/include/core/SkImageFilter.h" | 38 #include "third_party/skia/include/core/SkImageFilter.h" |
| 37 #include "third_party/skia/include/core/SkPicture.h" | 39 #include "third_party/skia/include/core/SkPicture.h" |
| 38 #include "ui/gfx/geometry/point3_f.h" | 40 #include "ui/gfx/geometry/point3_f.h" |
| 39 #include "ui/gfx/geometry/rect.h" | 41 #include "ui/gfx/geometry/rect.h" |
| 40 #include "ui/gfx/geometry/rect_f.h" | 42 #include "ui/gfx/geometry/rect_f.h" |
| 41 #include "ui/gfx/geometry/scroll_offset.h" | 43 #include "ui/gfx/geometry/scroll_offset.h" |
| 42 #include "ui/gfx/transform.h" | 44 #include "ui/gfx/transform.h" |
| 43 | 45 |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0; | 556 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0; |
| 555 } | 557 } |
| 556 | 558 |
| 557 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; | 559 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; |
| 558 | 560 |
| 559 virtual skia::RefPtr<SkPicture> GetPicture(); | 561 virtual skia::RefPtr<SkPicture> GetPicture(); |
| 560 | 562 |
| 561 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); | 563 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
| 562 virtual void PushPropertiesTo(LayerImpl* layer); | 564 virtual void PushPropertiesTo(LayerImpl* layer); |
| 563 | 565 |
| 564 virtual void GetAllTilesForTracing(std::set<const Tile*>* tiles) const; | 566 virtual void GetAllTilesAndPrioritiesForTracing( |
| 567 std::map<const Tile*, TilePriority>* tile_map) const; |
| 565 virtual void AsValueInto(base::trace_event::TracedValue* dict) const; | 568 virtual void AsValueInto(base::trace_event::TracedValue* dict) const; |
| 566 | 569 |
| 567 virtual size_t GPUMemoryUsageInBytes() const; | 570 virtual size_t GPUMemoryUsageInBytes() const; |
| 568 | 571 |
| 569 void SetNeedsPushProperties(); | 572 void SetNeedsPushProperties(); |
| 570 void AddDependentNeedsPushProperties(); | 573 void AddDependentNeedsPushProperties(); |
| 571 void RemoveDependentNeedsPushProperties(); | 574 void RemoveDependentNeedsPushProperties(); |
| 572 bool parent_should_know_need_push_properties() const { | 575 bool parent_should_know_need_push_properties() const { |
| 573 return needs_push_properties() || descendant_needs_push_properties(); | 576 return needs_push_properties() || descendant_needs_push_properties(); |
| 574 } | 577 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 593 const std::vector<FrameTimingRequest>& frame_timing_requests() const { | 596 const std::vector<FrameTimingRequest>& frame_timing_requests() const { |
| 594 return frame_timing_requests_; | 597 return frame_timing_requests_; |
| 595 } | 598 } |
| 596 | 599 |
| 597 SyncedScrollOffset* synced_scroll_offset() { return scroll_offset_.get(); } | 600 SyncedScrollOffset* synced_scroll_offset() { return scroll_offset_.get(); } |
| 598 | 601 |
| 599 // Get the correct invalidation region instead of conservative Rect | 602 // Get the correct invalidation region instead of conservative Rect |
| 600 // for layers that provide it. | 603 // for layers that provide it. |
| 601 virtual Region GetInvalidationRegion(); | 604 virtual Region GetInvalidationRegion(); |
| 602 | 605 |
| 606 virtual gfx::Rect GetEnclosingRectInTargetSpace() const; |
| 607 |
| 603 protected: | 608 protected: |
| 604 LayerImpl(LayerTreeImpl* layer_impl, | 609 LayerImpl(LayerTreeImpl* layer_impl, |
| 605 int id, | 610 int id, |
| 606 scoped_refptr<SyncedScrollOffset> scroll_offset); | 611 scoped_refptr<SyncedScrollOffset> scroll_offset); |
| 607 LayerImpl(LayerTreeImpl* layer_impl, int id); | 612 LayerImpl(LayerTreeImpl* layer_impl, int id); |
| 608 | 613 |
| 609 // Get the color and size of the layer's debug border. | 614 // Get the color and size of the layer's debug border. |
| 610 virtual void GetDebugBorderProperties(SkColor* color, float* width) const; | 615 virtual void GetDebugBorderProperties(SkColor* color, float* width) const; |
| 611 | 616 |
| 612 void AppendDebugBorderQuad(RenderPass* render_pass, | 617 void AppendDebugBorderQuad(RenderPass* render_pass, |
| 613 const gfx::Size& content_bounds, | 618 const gfx::Size& content_bounds, |
| 614 const SharedQuadState* shared_quad_state, | 619 const SharedQuadState* shared_quad_state, |
| 615 AppendQuadsData* append_quads_data) const; | 620 AppendQuadsData* append_quads_data) const; |
| 616 void AppendDebugBorderQuad(RenderPass* render_pass, | 621 void AppendDebugBorderQuad(RenderPass* render_pass, |
| 617 const gfx::Size& content_bounds, | 622 const gfx::Size& content_bounds, |
| 618 const SharedQuadState* shared_quad_state, | 623 const SharedQuadState* shared_quad_state, |
| 619 AppendQuadsData* append_quads_data, | 624 AppendQuadsData* append_quads_data, |
| 620 SkColor color, | 625 SkColor color, |
| 621 float width) const; | 626 float width) const; |
| 622 | 627 |
| 623 void NoteLayerPropertyChanged(); | 628 void NoteLayerPropertyChanged(); |
| 624 void NoteLayerPropertyChangedForSubtree(); | 629 void NoteLayerPropertyChangedForSubtree(); |
| 625 | 630 |
| 626 // Note carefully this does not affect the current layer. | 631 // Note carefully this does not affect the current layer. |
| 627 void NoteLayerPropertyChangedForDescendants(); | 632 void NoteLayerPropertyChangedForDescendants(); |
| 628 | 633 |
| 634 gfx::Rect GetScaledEnclosingRectInTargetSpace(float scale) const; |
| 635 |
| 629 private: | 636 private: |
| 630 void PushScrollOffset(const gfx::ScrollOffset* scroll_offset); | 637 void PushScrollOffset(const gfx::ScrollOffset* scroll_offset); |
| 631 void DidUpdateScrollOffset(); | 638 void DidUpdateScrollOffset(); |
| 632 void NoteLayerPropertyChangedForDescendantsInternal(); | 639 void NoteLayerPropertyChangedForDescendantsInternal(); |
| 633 | 640 |
| 634 virtual const char* LayerTypeAsString() const; | 641 virtual const char* LayerTypeAsString() const; |
| 635 | 642 |
| 636 // Properties internal to LayerImpl | 643 // Properties internal to LayerImpl |
| 637 LayerImpl* parent_; | 644 LayerImpl* parent_; |
| 638 OwnedLayerImplList children_; | 645 OwnedLayerImplList children_; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 | 773 |
| 767 std::vector<FrameTimingRequest> frame_timing_requests_; | 774 std::vector<FrameTimingRequest> frame_timing_requests_; |
| 768 bool frame_timing_requests_dirty_; | 775 bool frame_timing_requests_dirty_; |
| 769 | 776 |
| 770 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 777 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 771 }; | 778 }; |
| 772 | 779 |
| 773 } // namespace cc | 780 } // namespace cc |
| 774 | 781 |
| 775 #endif // CC_LAYERS_LAYER_IMPL_H_ | 782 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |