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 <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 virtual void DidSwapBuffersCompleteOnImplThread() = 0; | 75 virtual void DidSwapBuffersCompleteOnImplThread() = 0; |
76 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 76 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
77 virtual void NotifyReadyToActivate() = 0; | 77 virtual void NotifyReadyToActivate() = 0; |
78 virtual void NotifyReadyToDraw() = 0; | 78 virtual void NotifyReadyToDraw() = 0; |
79 // Please call these 3 functions through | 79 // Please call these 3 functions through |
80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
81 // SetNeedsAnimate(). | 81 // SetNeedsAnimate(). |
82 virtual void SetNeedsRedrawOnImplThread() = 0; | 82 virtual void SetNeedsRedrawOnImplThread() = 0; |
83 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 83 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
84 virtual void SetNeedsAnimateOnImplThread() = 0; | 84 virtual void SetNeedsAnimateOnImplThread() = 0; |
85 virtual void DidInitializeVisibleTileOnImplThread() = 0; | |
86 virtual void SetNeedsCommitOnImplThread() = 0; | 85 virtual void SetNeedsCommitOnImplThread() = 0; |
87 virtual void SetNeedsManageTilesOnImplThread() = 0; | 86 virtual void SetNeedsManageTilesOnImplThread() = 0; |
88 virtual void PostAnimationEventsToMainThreadOnImplThread( | 87 virtual void PostAnimationEventsToMainThreadOnImplThread( |
89 scoped_ptr<AnimationEventsVector> events) = 0; | 88 scoped_ptr<AnimationEventsVector> events) = 0; |
90 // Returns true if resources were deleted by this call. | 89 // Returns true if resources were deleted by this call. |
91 virtual bool ReduceContentsTextureMemoryOnImplThread( | 90 virtual bool ReduceContentsTextureMemoryOnImplThread( |
92 size_t limit_bytes, | 91 size_t limit_bytes, |
93 int priority_cutoff) = 0; | 92 int priority_cutoff) = 0; |
94 virtual bool IsInsideDraw() = 0; | 93 virtual bool IsInsideDraw() = 0; |
95 virtual void RenewTreePriority() = 0; | 94 virtual void RenewTreePriority() = 0; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 FrameData(); | 164 FrameData(); |
166 ~FrameData() override; | 165 ~FrameData() override; |
167 void AsValueInto(base::debug::TracedValue* value) const; | 166 void AsValueInto(base::debug::TracedValue* value) const; |
168 | 167 |
169 std::vector<gfx::Rect> occluding_screen_space_rects; | 168 std::vector<gfx::Rect> occluding_screen_space_rects; |
170 std::vector<gfx::Rect> non_occluding_screen_space_rects; | 169 std::vector<gfx::Rect> non_occluding_screen_space_rects; |
171 RenderPassList render_passes; | 170 RenderPassList render_passes; |
172 RenderPassIdHashMap render_passes_by_id; | 171 RenderPassIdHashMap render_passes_by_id; |
173 const LayerImplList* render_surface_layer_list; | 172 const LayerImplList* render_surface_layer_list; |
174 LayerImplList will_draw_layers; | 173 LayerImplList will_draw_layers; |
175 bool contains_incomplete_tile; | |
176 bool has_no_damage; | 174 bool has_no_damage; |
177 | 175 |
178 // RenderPassSink implementation. | 176 // RenderPassSink implementation. |
179 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; | 177 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; |
180 }; | 178 }; |
181 | 179 |
182 virtual void BeginMainFrameAborted(bool did_handle); | 180 virtual void BeginMainFrameAborted(bool did_handle); |
183 virtual void BeginCommit(); | 181 virtual void BeginCommit(); |
184 virtual void CommitComplete(); | 182 virtual void CommitComplete(); |
185 virtual void Animate(base::TimeTicks monotonic_time); | 183 virtual void Animate(base::TimeTicks monotonic_time); |
(...skipping 17 matching lines...) Expand all Loading... |
203 const LayerTreeSettings& settings() const { return settings_; } | 201 const LayerTreeSettings& settings() const { return settings_; } |
204 | 202 |
205 // Evict all textures by enforcing a memory policy with an allocation of 0. | 203 // Evict all textures by enforcing a memory policy with an allocation of 0. |
206 void EvictTexturesForTesting(); | 204 void EvictTexturesForTesting(); |
207 | 205 |
208 // When blocking, this prevents client_->NotifyReadyToActivate() from being | 206 // When blocking, this prevents client_->NotifyReadyToActivate() from being |
209 // called. When disabled, it calls client_->NotifyReadyToActivate() | 207 // called. When disabled, it calls client_->NotifyReadyToActivate() |
210 // immediately if any notifications had been blocked while blocking. | 208 // immediately if any notifications had been blocked while blocking. |
211 virtual void BlockNotifyReadyToActivateForTesting(bool block); | 209 virtual void BlockNotifyReadyToActivateForTesting(bool block); |
212 | 210 |
213 // This allows us to inject DidInitializeVisibleTile events for testing. | |
214 void DidInitializeVisibleTileForTesting(); | |
215 | |
216 // Resets all of the trees to an empty state. | 211 // Resets all of the trees to an empty state. |
217 void ResetTreesForTesting(); | 212 void ResetTreesForTesting(); |
218 | 213 |
219 DrawMode GetDrawMode() const; | 214 DrawMode GetDrawMode() const; |
220 | 215 |
221 // Viewport size in draw space: this size is in physical pixels and is used | 216 // Viewport size in draw space: this size is in physical pixels and is used |
222 // for draw properties, tilings, quads and render passes. | 217 // for draw properties, tilings, quads and render passes. |
223 gfx::Size DrawViewportSize() const; | 218 gfx::Size DrawViewportSize() const; |
224 | 219 |
225 // Viewport rect in view space used for tiling prioritization. | 220 // Viewport rect in view space used for tiling prioritization. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 290 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
296 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 291 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
297 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 292 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
298 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } | 293 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } |
299 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 294 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
300 // Returns the tree LTH synchronizes with. | 295 // Returns the tree LTH synchronizes with. |
301 LayerTreeImpl* sync_tree() { | 296 LayerTreeImpl* sync_tree() { |
302 return pending_tree_ ? pending_tree_.get() : active_tree_.get(); | 297 return pending_tree_ ? pending_tree_.get() : active_tree_.get(); |
303 } | 298 } |
304 virtual void CreatePendingTree(); | 299 virtual void CreatePendingTree(); |
305 virtual void UpdateVisibleTiles(); | |
306 virtual void ActivateSyncTree(); | 300 virtual void ActivateSyncTree(); |
307 | 301 |
308 // Shortcuts to layers on the active tree. | 302 // Shortcuts to layers on the active tree. |
309 LayerImpl* RootLayer() const; | 303 LayerImpl* RootLayer() const; |
310 LayerImpl* InnerViewportScrollLayer() const; | 304 LayerImpl* InnerViewportScrollLayer() const; |
311 LayerImpl* OuterViewportScrollLayer() const; | 305 LayerImpl* OuterViewportScrollLayer() const; |
312 LayerImpl* CurrentlyScrollingLayer() const; | 306 LayerImpl* CurrentlyScrollingLayer() const; |
313 | 307 |
314 int scroll_layer_id_when_mouse_over_scrollbar() const { | 308 int scroll_layer_id_when_mouse_over_scrollbar() const { |
315 return scroll_layer_id_when_mouse_over_scrollbar_; | 309 return scroll_layer_id_when_mouse_over_scrollbar_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 LayerImpl* layer_hit_by_point, | 561 LayerImpl* layer_hit_by_point, |
568 bool* scroll_on_main_thread, | 562 bool* scroll_on_main_thread, |
569 bool* optional_has_ancestor_scroll_handler) const; | 563 bool* optional_has_ancestor_scroll_handler) const; |
570 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, | 564 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, |
571 LayerImpl* layer_impl); | 565 LayerImpl* layer_impl); |
572 void StartScrollbarFadeRecursive(LayerImpl* layer); | 566 void StartScrollbarFadeRecursive(LayerImpl* layer); |
573 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, | 567 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, |
574 bool zero_budget); | 568 bool zero_budget); |
575 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 569 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
576 | 570 |
577 void DidInitializeVisibleTile(); | |
578 | |
579 void MarkUIResourceNotEvicted(UIResourceId uid); | 571 void MarkUIResourceNotEvicted(UIResourceId uid); |
580 | 572 |
581 void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 573 void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
582 void NotifySwapPromiseMonitorsOfForwardingToMainThread(); | 574 void NotifySwapPromiseMonitorsOfForwardingToMainThread(); |
583 | 575 |
584 typedef base::hash_map<UIResourceId, UIResourceData> | 576 typedef base::hash_map<UIResourceId, UIResourceData> |
585 UIResourceMap; | 577 UIResourceMap; |
586 UIResourceMap ui_resource_map_; | 578 UIResourceMap ui_resource_map_; |
587 | 579 |
588 // Resources that were evicted by EvictAllUIResources. Resources are removed | 580 // Resources that were evicted by EvictAllUIResources. Resources are removed |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 684 |
693 // Expected time between two begin impl frame calls. | 685 // Expected time between two begin impl frame calls. |
694 base::TimeDelta begin_impl_frame_interval_; | 686 base::TimeDelta begin_impl_frame_interval_; |
695 | 687 |
696 scoped_ptr<AnimationRegistrar> animation_registrar_; | 688 scoped_ptr<AnimationRegistrar> animation_registrar_; |
697 | 689 |
698 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 690 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
699 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 691 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
700 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 692 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
701 | 693 |
702 bool need_to_update_visible_tiles_before_draw_; | |
703 | |
704 // Optional callback to notify of new tree activations. | 694 // Optional callback to notify of new tree activations. |
705 base::Closure tree_activation_callback_; | 695 base::Closure tree_activation_callback_; |
706 | 696 |
707 SharedBitmapManager* shared_bitmap_manager_; | 697 SharedBitmapManager* shared_bitmap_manager_; |
708 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 698 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
709 int id_; | 699 int id_; |
710 | 700 |
711 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 701 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
712 | 702 |
713 std::vector<PictureLayerImpl*> picture_layers_; | 703 std::vector<PictureLayerImpl*> picture_layers_; |
714 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 704 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
715 | 705 |
716 bool requires_high_res_to_draw_; | 706 bool requires_high_res_to_draw_; |
| 707 bool required_for_draw_tile_is_top_of_raster_queue_; |
717 | 708 |
718 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 709 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
719 }; | 710 }; |
720 | 711 |
721 } // namespace cc | 712 } // namespace cc |
722 | 713 |
723 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 714 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |