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_TREES_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <bitset> |
10 #include <memory> | 11 #include <memory> |
11 #include <set> | 12 #include <set> |
12 #include <string> | 13 #include <string> |
13 #include <unordered_map> | 14 #include <unordered_map> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "base/callback.h" | 17 #include "base/callback.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
19 #include "cc/animation/layer_tree_mutator.h" | 20 #include "cc/animation/layer_tree_mutator.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 ScrollNode* scroll_node) const; | 608 ScrollNode* scroll_node) const; |
608 | 609 |
609 // Returns true if a scroll offset animation is created and false if we scroll | 610 // Returns true if a scroll offset animation is created and false if we scroll |
610 // by the desired amount without an animation. | 611 // by the desired amount without an animation. |
611 bool ScrollAnimationCreate(ScrollNode* scroll_node, | 612 bool ScrollAnimationCreate(ScrollNode* scroll_node, |
612 const gfx::Vector2dF& scroll_amount); | 613 const gfx::Vector2dF& scroll_amount); |
613 | 614 |
614 void SetLayerTreeMutator(LayerTreeMutator* mutator); | 615 void SetLayerTreeMutator(LayerTreeMutator* mutator); |
615 LayerTreeMutator* mutator() { return mutator_; } | 616 LayerTreeMutator* mutator() { return mutator_; } |
616 | 617 |
| 618 void set_fixed_raster_scale_has_blurry_content() { |
| 619 has_fixed_raster_scale_blurry_content_ = true; |
| 620 } |
| 621 bool has_fixed_raster_scale_blurry_content() const { |
| 622 return has_fixed_raster_scale_blurry_content_; |
| 623 } |
| 624 |
| 625 bool HasFixedRasterScalePotentialPerformanceRegression() const; |
| 626 void SetFixedRasterScaleAttemptedToChangeScale(); |
| 627 |
617 protected: | 628 protected: |
618 LayerTreeHostImpl( | 629 LayerTreeHostImpl( |
619 const LayerTreeSettings& settings, | 630 const LayerTreeSettings& settings, |
620 LayerTreeHostImplClient* client, | 631 LayerTreeHostImplClient* client, |
621 TaskRunnerProvider* task_runner_provider, | 632 TaskRunnerProvider* task_runner_provider, |
622 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 633 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
623 SharedBitmapManager* shared_bitmap_manager, | 634 SharedBitmapManager* shared_bitmap_manager, |
624 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 635 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
625 TaskGraphRunner* task_graph_runner, | 636 TaskGraphRunner* task_graph_runner, |
626 int id); | 637 int id); |
627 | 638 |
628 // Virtual for testing. | 639 // Virtual for testing. |
629 virtual bool AnimateLayers(base::TimeTicks monotonic_time); | 640 virtual bool AnimateLayers(base::TimeTicks monotonic_time); |
630 | 641 |
631 bool is_likely_to_require_a_draw() const { | 642 bool is_likely_to_require_a_draw() const { |
632 return is_likely_to_require_a_draw_; | 643 return is_likely_to_require_a_draw_; |
633 } | 644 } |
634 | 645 |
635 // Removes empty or orphan RenderPasses from the frame. | 646 // Removes empty or orphan RenderPasses from the frame. |
636 static void RemoveRenderPasses(FrameData* frame); | 647 static void RemoveRenderPasses(FrameData* frame); |
637 | 648 |
638 LayerTreeHostImplClient* client_; | 649 LayerTreeHostImplClient* client_; |
639 TaskRunnerProvider* task_runner_provider_; | 650 TaskRunnerProvider* task_runner_provider_; |
640 | 651 |
641 BeginFrameTracker current_begin_frame_tracker_; | 652 BeginFrameTracker current_begin_frame_tracker_; |
642 | 653 |
643 private: | 654 private: |
| 655 enum { kFixedRasterScaleAttemptedScaleChangeThreshold = 5 }; |
| 656 enum { kFixedRasterScaleAttemptedScaleChangeHistoryCount = 10 }; |
| 657 |
644 gfx::Vector2dF ScrollNodeWithViewportSpaceDelta( | 658 gfx::Vector2dF ScrollNodeWithViewportSpaceDelta( |
645 ScrollNode* scroll_node, | 659 ScrollNode* scroll_node, |
646 const gfx::PointF& viewport_point, | 660 const gfx::PointF& viewport_point, |
647 const gfx::Vector2dF& viewport_delta, | 661 const gfx::Vector2dF& viewport_delta, |
648 ScrollTree* scroll_tree); | 662 ScrollTree* scroll_tree); |
649 | 663 |
650 void CreateAndSetRenderer(); | 664 void CreateAndSetRenderer(); |
651 void CleanUpTileManagerAndUIResources(); | 665 void CleanUpTileManagerAndUIResources(); |
652 void CreateTileManagerResources(); | 666 void CreateTileManagerResources(); |
653 void ReleaseTreeResources(); | 667 void ReleaseTreeResources(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 851 |
838 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 852 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
839 | 853 |
840 bool requires_high_res_to_draw_; | 854 bool requires_high_res_to_draw_; |
841 bool is_likely_to_require_a_draw_; | 855 bool is_likely_to_require_a_draw_; |
842 | 856 |
843 std::unique_ptr<Viewport> viewport_; | 857 std::unique_ptr<Viewport> viewport_; |
844 | 858 |
845 LayerTreeMutator* mutator_; | 859 LayerTreeMutator* mutator_; |
846 | 860 |
| 861 bool has_fixed_raster_scale_blurry_content_; |
| 862 std::bitset<kFixedRasterScaleAttemptedScaleChangeHistoryCount> |
| 863 fixed_raster_scale_attempted_scale_change_history_; |
| 864 |
847 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 865 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
848 }; | 866 }; |
849 | 867 |
850 } // namespace cc | 868 } // namespace cc |
851 | 869 |
852 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 870 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |