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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "ui/gfx/geometry/rect.h" | 39 #include "ui/gfx/geometry/rect.h" |
40 #include "ui/gfx/geometry/rect_f.h" | 40 #include "ui/gfx/geometry/rect_f.h" |
41 #include "ui/gfx/geometry/scroll_offset.h" | 41 #include "ui/gfx/geometry/scroll_offset.h" |
42 #include "ui/gfx/transform.h" | 42 #include "ui/gfx/transform.h" |
43 | 43 |
44 namespace base { | 44 namespace base { |
45 namespace trace_event { | 45 namespace trace_event { |
46 class ConvertableToTraceFormat; | 46 class ConvertableToTraceFormat; |
47 class TracedValue; | 47 class TracedValue; |
48 } | 48 } |
49 | 49 class DictionaryValue; |
50 // TODO(ssid): remove these aliases after the tracing clients are moved to the | |
51 // new trace_event namespace. See crbug.com/451032. ETA: March 2015 | |
52 namespace debug { | |
53 using ::base::trace_event::ConvertableToTraceFormat; | |
54 using ::base::trace_event::TracedValue; | |
55 } | 50 } |
56 class DictionaryValue; | |
57 } // namespace base | |
58 | 51 |
59 namespace cc { | 52 namespace cc { |
60 | 53 |
61 class LayerTreeHostImpl; | 54 class LayerTreeHostImpl; |
62 class LayerTreeImpl; | 55 class LayerTreeImpl; |
63 class MicroBenchmarkImpl; | 56 class MicroBenchmarkImpl; |
64 class Occlusion; | 57 class Occlusion; |
65 template <typename LayerType> | 58 template <typename LayerType> |
66 class OcclusionTracker; | 59 class OcclusionTracker; |
67 class RenderPass; | 60 class RenderPass; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 191 |
199 bool has_mask() const { return mask_layer_; } | 192 bool has_mask() const { return mask_layer_; } |
200 bool has_replica() const { return replica_layer_; } | 193 bool has_replica() const { return replica_layer_; } |
201 bool replica_has_mask() const { | 194 bool replica_has_mask() const { |
202 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); | 195 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); |
203 } | 196 } |
204 | 197 |
205 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } | 198 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } |
206 | 199 |
207 void PopulateSharedQuadState(SharedQuadState* state) const; | 200 void PopulateSharedQuadState(SharedQuadState* state) const; |
| 201 void PopulateScaledSharedQuadState(SharedQuadState* state, float scale) const; |
208 // WillDraw must be called before AppendQuads. If WillDraw returns false, | 202 // WillDraw must be called before AppendQuads. If WillDraw returns false, |
209 // AppendQuads and DidDraw will not be called. If WillDraw returns true, | 203 // AppendQuads and DidDraw will not be called. If WillDraw returns true, |
210 // DidDraw is guaranteed to be called before another WillDraw or before | 204 // DidDraw is guaranteed to be called before another WillDraw or before |
211 // the layer is destroyed. To enforce this, any class that overrides | 205 // the layer is destroyed. To enforce this, any class that overrides |
212 // WillDraw/DidDraw must call the base class version only if WillDraw | 206 // WillDraw/DidDraw must call the base class version only if WillDraw |
213 // returns true. | 207 // returns true. |
214 virtual bool WillDraw(DrawMode draw_mode, | 208 virtual bool WillDraw(DrawMode draw_mode, |
215 ResourceProvider* resource_provider); | 209 ResourceProvider* resource_provider); |
216 virtual void AppendQuads(RenderPass* render_pass, | 210 virtual void AppendQuads(RenderPass* render_pass, |
217 const Occlusion& occlusion_in_content_space, | |
218 AppendQuadsData* append_quads_data) {} | 211 AppendQuadsData* append_quads_data) {} |
219 virtual void DidDraw(ResourceProvider* resource_provider); | 212 virtual void DidDraw(ResourceProvider* resource_provider); |
220 | 213 |
221 virtual void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 214 virtual void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
222 gfx::Size* resource_size) const; | 215 gfx::Size* resource_size) const; |
223 | 216 |
224 virtual bool HasDelegatedContent() const; | 217 virtual bool HasDelegatedContent() const; |
225 virtual bool HasContributingDelegatedRenderPasses() const; | 218 virtual bool HasContributingDelegatedRenderPasses() const; |
226 virtual RenderPassId FirstContributingRenderPassId() const; | 219 virtual RenderPassId FirstContributingRenderPassId() const; |
227 virtual RenderPassId NextContributingRenderPassId(RenderPassId id) const; | 220 virtual RenderPassId NextContributingRenderPassId(RenderPassId id) const; |
228 | 221 |
229 // Updates the layer's tiles. This should return true if meaningful work was | |
230 // done. That is, if an early-out was hit and as a result the internal state | |
231 // of tiles didn't change, this function should return false. | |
232 virtual bool UpdateTiles(const Occlusion& occlusion_in_layer_space, | |
233 bool resourceless_software_draw); | |
234 virtual void NotifyTileStateChanged(const Tile* tile) {} | 222 virtual void NotifyTileStateChanged(const Tile* tile) {} |
235 | 223 |
236 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); | 224 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); |
237 | 225 |
238 // Returns true if this layer has content to draw. | 226 // Returns true if this layer has content to draw. |
239 void SetDrawsContent(bool draws_content); | 227 void SetDrawsContent(bool draws_content); |
240 bool DrawsContent() const { return draws_content_; } | 228 bool DrawsContent() const { return draws_content_; } |
241 | 229 |
242 int NumDescendantsThatDrawContent() const; | 230 int NumDescendantsThatDrawContent() const; |
243 void SetHideLayerAndSubtree(bool hide); | 231 void SetHideLayerAndSubtree(bool hide); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 } | 555 } |
568 | 556 |
569 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; | 557 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; |
570 | 558 |
571 virtual skia::RefPtr<SkPicture> GetPicture(); | 559 virtual skia::RefPtr<SkPicture> GetPicture(); |
572 | 560 |
573 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); | 561 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
574 virtual void PushPropertiesTo(LayerImpl* layer); | 562 virtual void PushPropertiesTo(LayerImpl* layer); |
575 | 563 |
576 virtual void GetAllTilesForTracing(std::set<const Tile*>* tiles) const; | 564 virtual void GetAllTilesForTracing(std::set<const Tile*>* tiles) const; |
577 virtual void AsValueInto(base::debug::TracedValue* dict) const; | 565 virtual void AsValueInto(base::trace_event::TracedValue* dict) const; |
578 | 566 |
579 virtual size_t GPUMemoryUsageInBytes() const; | 567 virtual size_t GPUMemoryUsageInBytes() const; |
580 | 568 |
581 void SetNeedsPushProperties(); | 569 void SetNeedsPushProperties(); |
582 void AddDependentNeedsPushProperties(); | 570 void AddDependentNeedsPushProperties(); |
583 void RemoveDependentNeedsPushProperties(); | 571 void RemoveDependentNeedsPushProperties(); |
584 bool parent_should_know_need_push_properties() const { | 572 bool parent_should_know_need_push_properties() const { |
585 return needs_push_properties() || descendant_needs_push_properties(); | 573 return needs_push_properties() || descendant_needs_push_properties(); |
586 } | 574 } |
587 | 575 |
588 bool needs_push_properties() const { return needs_push_properties_; } | 576 bool needs_push_properties() const { return needs_push_properties_; } |
589 bool descendant_needs_push_properties() const { | 577 bool descendant_needs_push_properties() const { |
590 return num_dependents_need_push_properties_ > 0; | 578 return num_dependents_need_push_properties_ > 0; |
591 } | 579 } |
592 | 580 |
593 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark); | 581 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark); |
594 | 582 |
595 virtual void SetDebugInfo( | 583 virtual void SetDebugInfo( |
596 scoped_refptr<base::debug::ConvertableToTraceFormat> other); | 584 scoped_refptr<base::trace_event::ConvertableToTraceFormat> other); |
597 | 585 |
598 bool IsDrawnRenderSurfaceLayerListMember() const; | 586 bool IsDrawnRenderSurfaceLayerListMember() const; |
599 | 587 |
600 void Set3dSortingContextId(int id); | 588 void Set3dSortingContextId(int id); |
601 int sorting_context_id() { return sorting_context_id_; } | 589 int sorting_context_id() { return sorting_context_id_; } |
602 | 590 |
603 void PassFrameTimingRequests( | 591 void PassFrameTimingRequests( |
604 std::vector<FrameTimingRequest>* frame_timing_requests); | 592 std::vector<FrameTimingRequest>* frame_timing_requests); |
605 const std::vector<FrameTimingRequest>& frame_timing_requests() const { | 593 const std::vector<FrameTimingRequest>& frame_timing_requests() const { |
606 return frame_timing_requests_; | 594 return frame_timing_requests_; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; | 750 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; |
763 | 751 |
764 scoped_ptr<ScrollbarSet> scrollbars_; | 752 scoped_ptr<ScrollbarSet> scrollbars_; |
765 | 753 |
766 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 754 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
767 | 755 |
768 // Group of properties that need to be computed based on the layer tree | 756 // Group of properties that need to be computed based on the layer tree |
769 // hierarchy before layers can be drawn. | 757 // hierarchy before layers can be drawn. |
770 DrawProperties<LayerImpl> draw_properties_; | 758 DrawProperties<LayerImpl> draw_properties_; |
771 | 759 |
772 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; | 760 scoped_refptr<base::trace_event::ConvertableToTraceFormat> debug_info_; |
773 scoped_ptr<RenderSurfaceImpl> render_surface_; | 761 scoped_ptr<RenderSurfaceImpl> render_surface_; |
774 | 762 |
775 std::vector<FrameTimingRequest> frame_timing_requests_; | 763 std::vector<FrameTimingRequest> frame_timing_requests_; |
776 bool frame_timing_requests_dirty_; | 764 bool frame_timing_requests_dirty_; |
777 | 765 |
778 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 766 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
779 }; | 767 }; |
780 | 768 |
781 } // namespace cc | 769 } // namespace cc |
782 | 770 |
783 #endif // CC_LAYERS_LAYER_IMPL_H_ | 771 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |