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