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