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 <memory> | 10 #include <memory> |
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/time/time.h" | 18 #include "base/time/time.h" |
19 #include "cc/animation/layer_tree_mutator.h" | 19 #include "cc/animation/layer_tree_mutator.h" |
20 #include "cc/base/cc_export.h" | 20 #include "cc/base/cc_export.h" |
21 #include "cc/base/synced_property.h" | 21 #include "cc/base/synced_property.h" |
22 #include "cc/debug/frame_timing_tracker.h" | |
23 #include "cc/debug/micro_benchmark_controller_impl.h" | 22 #include "cc/debug/micro_benchmark_controller_impl.h" |
24 #include "cc/input/input_handler.h" | 23 #include "cc/input/input_handler.h" |
25 #include "cc/input/scrollbar_animation_controller.h" | 24 #include "cc/input/scrollbar_animation_controller.h" |
26 #include "cc/input/top_controls_manager_client.h" | 25 #include "cc/input/top_controls_manager_client.h" |
27 #include "cc/layers/layer_collections.h" | 26 #include "cc/layers/layer_collections.h" |
28 #include "cc/layers/render_pass_sink.h" | 27 #include "cc/layers/render_pass_sink.h" |
29 #include "cc/output/begin_frame_args.h" | 28 #include "cc/output/begin_frame_args.h" |
30 #include "cc/output/managed_memory_policy.h" | 29 #include "cc/output/managed_memory_policy.h" |
31 #include "cc/output/output_surface_client.h" | 30 #include "cc/output/output_surface_client.h" |
32 #include "cc/output/renderer.h" | 31 #include "cc/output/renderer.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 virtual void DidActivateSyncTree() = 0; | 124 virtual void DidActivateSyncTree() = 0; |
126 virtual void WillPrepareTiles() = 0; | 125 virtual void WillPrepareTiles() = 0; |
127 virtual void DidPrepareTiles() = 0; | 126 virtual void DidPrepareTiles() = 0; |
128 | 127 |
129 // Called when page scale animation has completed on the impl thread. | 128 // Called when page scale animation has completed on the impl thread. |
130 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; | 129 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; |
131 | 130 |
132 // Called when output surface asks for a draw. | 131 // Called when output surface asks for a draw. |
133 virtual void OnDrawForOutputSurface(bool resourceless_software_draw) = 0; | 132 virtual void OnDrawForOutputSurface(bool resourceless_software_draw) = 0; |
134 | 133 |
135 virtual void PostFrameTimingEventsOnImplThread( | |
136 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | |
137 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> | |
138 main_frame_events) = 0; | |
139 | |
140 protected: | 134 protected: |
141 virtual ~LayerTreeHostImplClient() {} | 135 virtual ~LayerTreeHostImplClient() {} |
142 }; | 136 }; |
143 | 137 |
144 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 138 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
145 // state. | 139 // state. |
146 class CC_EXPORT LayerTreeHostImpl | 140 class CC_EXPORT LayerTreeHostImpl |
147 : public InputHandler, | 141 : public InputHandler, |
148 public RendererClient, | 142 public RendererClient, |
149 public TileManagerClient, | 143 public TileManagerClient, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 210 |
217 void UpdateViewportContainerSizes(); | 211 void UpdateViewportContainerSizes(); |
218 | 212 |
219 struct CC_EXPORT FrameData : public RenderPassSink { | 213 struct CC_EXPORT FrameData : public RenderPassSink { |
220 FrameData(); | 214 FrameData(); |
221 ~FrameData() override; | 215 ~FrameData() override; |
222 void AsValueInto(base::trace_event::TracedValue* value) const; | 216 void AsValueInto(base::trace_event::TracedValue* value) const; |
223 | 217 |
224 std::vector<gfx::Rect> occluding_screen_space_rects; | 218 std::vector<gfx::Rect> occluding_screen_space_rects; |
225 std::vector<gfx::Rect> non_occluding_screen_space_rects; | 219 std::vector<gfx::Rect> non_occluding_screen_space_rects; |
226 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; | |
227 RenderPassList render_passes; | 220 RenderPassList render_passes; |
228 const LayerImplList* render_surface_layer_list; | 221 const LayerImplList* render_surface_layer_list; |
229 LayerImplList will_draw_layers; | 222 LayerImplList will_draw_layers; |
230 bool has_no_damage; | 223 bool has_no_damage; |
231 | 224 |
232 // RenderPassSink implementation. | 225 // RenderPassSink implementation. |
233 void AppendRenderPass(std::unique_ptr<RenderPass> render_pass) override; | 226 void AppendRenderPass(std::unique_ptr<RenderPass> render_pass) override; |
234 | 227 |
235 private: | 228 private: |
236 DISALLOW_COPY_AND_ASSIGN(FrameData); | 229 DISALLOW_COPY_AND_ASSIGN(FrameData); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 571 |
579 bool SupportsImplScrolling() const; | 572 bool SupportsImplScrolling() const; |
580 bool CommitToActiveTree() const; | 573 bool CommitToActiveTree() const; |
581 | 574 |
582 virtual void CreateResourceAndTileTaskWorkerPool( | 575 virtual void CreateResourceAndTileTaskWorkerPool( |
583 std::unique_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 576 std::unique_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
584 std::unique_ptr<ResourcePool>* resource_pool); | 577 std::unique_ptr<ResourcePool>* resource_pool); |
585 | 578 |
586 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } | 579 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
587 | 580 |
588 FrameTimingTracker* frame_timing_tracker() { | |
589 return frame_timing_tracker_.get(); | |
590 } | |
591 | |
592 gfx::Vector2dF ScrollSingleNode(ScrollNode* scroll_node, | 581 gfx::Vector2dF ScrollSingleNode(ScrollNode* scroll_node, |
593 const gfx::Vector2dF& delta, | 582 const gfx::Vector2dF& delta, |
594 const gfx::Point& viewport_point, | 583 const gfx::Point& viewport_point, |
595 bool is_direct_manipulation, | 584 bool is_direct_manipulation, |
596 ScrollTree* scroll_tree); | 585 ScrollTree* scroll_tree); |
597 | 586 |
598 void set_output_is_secure(bool output_is_secure) { | 587 void set_output_is_secure(bool output_is_secure) { |
599 output_is_secure_ = output_is_secure; | 588 output_is_secure_ = output_is_secure; |
600 } | 589 } |
601 | 590 |
602 bool output_is_secure() const { return output_is_secure_; } | 591 bool output_is_secure() const { return output_is_secure_; } |
603 | 592 |
604 // Record main frame timing information. | |
605 // |start_of_main_frame_args| is the BeginFrameArgs of the beginning of the | |
606 // main frame (ie the frame that kicked off the main frame). | |
607 // |expected_next_main_frame_args| is the BeginFrameArgs of the frame that | |
608 // follows the completion of the main frame (whether it is activation or some | |
609 // other completion, such as early out). Note that if there is a main frame | |
610 // scheduled in that frame, then this BeginFrameArgs will become the main | |
611 // frame args. However, if no such frame is scheduled, then this _would_ be | |
612 // the main frame args if it was scheduled. | |
613 void RecordMainFrameTiming( | |
614 const BeginFrameArgs& start_of_main_frame_args, | |
615 const BeginFrameArgs& expected_next_main_frame_args); | |
616 | |
617 // Post the given frame timing events to the requester. | |
618 void PostFrameTimingEvents( | |
619 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | |
620 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> | |
621 main_frame_events); | |
622 | |
623 base::SingleThreadTaskRunner* GetTaskRunner() const { | 593 base::SingleThreadTaskRunner* GetTaskRunner() const { |
624 DCHECK(task_runner_provider_); | 594 DCHECK(task_runner_provider_); |
625 return task_runner_provider_->HasImplThread() | 595 return task_runner_provider_->HasImplThread() |
626 ? task_runner_provider_->ImplThreadTaskRunner() | 596 ? task_runner_provider_->ImplThreadTaskRunner() |
627 : task_runner_provider_->MainThreadTaskRunner(); | 597 : task_runner_provider_->MainThreadTaskRunner(); |
628 } | 598 } |
629 | 599 |
630 InputHandler::ScrollStatus TryScroll(const gfx::PointF& screen_space_point, | 600 InputHandler::ScrollStatus TryScroll(const gfx::PointF& screen_space_point, |
631 InputHandler::ScrollInputType type, | 601 InputHandler::ScrollInputType type, |
632 const ScrollTree& scroll_tree, | 602 const ScrollTree& scroll_tree, |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 SharedBitmapManager* shared_bitmap_manager_; | 829 SharedBitmapManager* shared_bitmap_manager_; |
860 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 830 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
861 TaskGraphRunner* task_graph_runner_; | 831 TaskGraphRunner* task_graph_runner_; |
862 int id_; | 832 int id_; |
863 | 833 |
864 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 834 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
865 | 835 |
866 bool requires_high_res_to_draw_; | 836 bool requires_high_res_to_draw_; |
867 bool is_likely_to_require_a_draw_; | 837 bool is_likely_to_require_a_draw_; |
868 | 838 |
869 std::unique_ptr<FrameTimingTracker> frame_timing_tracker_; | |
870 | |
871 std::unique_ptr<Viewport> viewport_; | 839 std::unique_ptr<Viewport> viewport_; |
872 | 840 |
873 LayerTreeMutator* mutator_; | 841 LayerTreeMutator* mutator_; |
874 | 842 |
875 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 843 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
876 }; | 844 }; |
877 | 845 |
878 } // namespace cc | 846 } // namespace cc |
879 | 847 |
880 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 848 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |