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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 FrameData(); | 168 FrameData(); |
170 ~FrameData() override; | 169 ~FrameData() override; |
171 void AsValueInto(base::debug::TracedValue* value) const; | 170 void AsValueInto(base::debug::TracedValue* value) const; |
172 | 171 |
173 std::vector<gfx::Rect> occluding_screen_space_rects; | 172 std::vector<gfx::Rect> occluding_screen_space_rects; |
174 std::vector<gfx::Rect> non_occluding_screen_space_rects; | 173 std::vector<gfx::Rect> non_occluding_screen_space_rects; |
175 RenderPassList render_passes; | 174 RenderPassList render_passes; |
176 RenderPassIdHashMap render_passes_by_id; | 175 RenderPassIdHashMap render_passes_by_id; |
177 const LayerImplList* render_surface_layer_list; | 176 const LayerImplList* render_surface_layer_list; |
178 LayerImplList will_draw_layers; | 177 LayerImplList will_draw_layers; |
179 bool contains_incomplete_tile; | |
180 bool has_no_damage; | 178 bool has_no_damage; |
181 | 179 |
182 // RenderPassSink implementation. | 180 // RenderPassSink implementation. |
183 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; | 181 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; |
184 }; | 182 }; |
185 | 183 |
186 virtual void BeginMainFrameAborted(bool did_handle); | 184 virtual void BeginMainFrameAborted(bool did_handle); |
187 virtual void BeginCommit(); | 185 virtual void BeginCommit(); |
188 virtual void CommitComplete(); | 186 virtual void CommitComplete(); |
189 virtual void Animate(base::TimeTicks monotonic_time); | 187 virtual void Animate(base::TimeTicks monotonic_time); |
(...skipping 18 matching lines...) Expand all Loading... | |
208 const LayerTreeSettings& settings() const { return settings_; } | 206 const LayerTreeSettings& settings() const { return settings_; } |
209 | 207 |
210 // Evict all textures by enforcing a memory policy with an allocation of 0. | 208 // Evict all textures by enforcing a memory policy with an allocation of 0. |
211 void EvictTexturesForTesting(); | 209 void EvictTexturesForTesting(); |
212 | 210 |
213 // When blocking, this prevents client_->NotifyReadyToActivate() from being | 211 // When blocking, this prevents client_->NotifyReadyToActivate() from being |
214 // called. When disabled, it calls client_->NotifyReadyToActivate() | 212 // called. When disabled, it calls client_->NotifyReadyToActivate() |
215 // immediately if any notifications had been blocked while blocking. | 213 // immediately if any notifications had been blocked while blocking. |
216 virtual void BlockNotifyReadyToActivateForTesting(bool block); | 214 virtual void BlockNotifyReadyToActivateForTesting(bool block); |
217 | 215 |
218 // This allows us to inject DidInitializeVisibleTile events for testing. | |
219 void DidInitializeVisibleTileForTesting(); | |
220 | |
221 // Resets all of the trees to an empty state. | 216 // Resets all of the trees to an empty state. |
222 void ResetTreesForTesting(); | 217 void ResetTreesForTesting(); |
223 | 218 |
224 DrawMode GetDrawMode() const; | 219 DrawMode GetDrawMode() const; |
225 | 220 |
226 // Viewport size in draw space: this size is in physical pixels and is used | 221 // Viewport size in draw space: this size is in physical pixels and is used |
227 // for draw properties, tilings, quads and render passes. | 222 // for draw properties, tilings, quads and render passes. |
228 gfx::Size DrawViewportSize() const; | 223 gfx::Size DrawViewportSize() const; |
229 | 224 |
230 // Viewport rect in view space used for tiling prioritization. | 225 // Viewport rect in view space used for tiling prioritization. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 TileManager* tile_manager() { return tile_manager_.get(); } | 282 TileManager* tile_manager() { return tile_manager_.get(); } |
288 void SetUseGpuRasterization(bool use_gpu); | 283 void SetUseGpuRasterization(bool use_gpu); |
289 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } | 284 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
290 bool create_low_res_tiling() const { | 285 bool create_low_res_tiling() const { |
291 return settings_.create_low_res_tiling && !use_gpu_rasterization_; | 286 return settings_.create_low_res_tiling && !use_gpu_rasterization_; |
292 } | 287 } |
293 ResourcePool* resource_pool() { return resource_pool_.get(); } | 288 ResourcePool* resource_pool() { return resource_pool_.get(); } |
294 Renderer* renderer() { return renderer_.get(); } | 289 Renderer* renderer() { return renderer_.get(); } |
295 const RendererCapabilitiesImpl& GetRendererCapabilities() const; | 290 const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
296 | 291 |
297 virtual bool SwapBuffers(const FrameData& frame); | 292 virtual bool SwapBuffers(const FrameData& frame); |
brianderson
2014/11/10 22:12:31
Does this still need to return a bool?
danakj
2014/11/12 20:19:40
Ya it's used by some tests and it seems useful for
| |
298 virtual void WillBeginImplFrame(const BeginFrameArgs& args); | 293 virtual void WillBeginImplFrame(const BeginFrameArgs& args); |
299 void DidModifyTilePriorities(); | 294 void DidModifyTilePriorities(); |
300 | 295 |
301 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 296 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
302 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 297 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
303 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 298 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
304 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 299 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
305 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } | 300 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } |
306 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 301 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
307 // Returns the tree LTH synchronizes with. | 302 // Returns the tree LTH synchronizes with. |
308 LayerTreeImpl* sync_tree() { | 303 LayerTreeImpl* sync_tree() { |
309 return pending_tree_ ? pending_tree_.get() : active_tree_.get(); | 304 return pending_tree_ ? pending_tree_.get() : active_tree_.get(); |
310 } | 305 } |
311 virtual void CreatePendingTree(); | 306 virtual void CreatePendingTree(); |
312 virtual void UpdateVisibleTiles(); | |
313 virtual void ActivateSyncTree(); | 307 virtual void ActivateSyncTree(); |
314 | 308 |
315 // Shortcuts to layers on the active tree. | 309 // Shortcuts to layers on the active tree. |
316 LayerImpl* RootLayer() const; | 310 LayerImpl* RootLayer() const; |
317 LayerImpl* InnerViewportScrollLayer() const; | 311 LayerImpl* InnerViewportScrollLayer() const; |
318 LayerImpl* OuterViewportScrollLayer() const; | 312 LayerImpl* OuterViewportScrollLayer() const; |
319 LayerImpl* CurrentlyScrollingLayer() const; | 313 LayerImpl* CurrentlyScrollingLayer() const; |
320 | 314 |
321 int scroll_layer_id_when_mouse_over_scrollbar() const { | 315 int scroll_layer_id_when_mouse_over_scrollbar() const { |
322 return scroll_layer_id_when_mouse_over_scrollbar_; | 316 return scroll_layer_id_when_mouse_over_scrollbar_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 LayerImpl* layer_hit_by_point, | 568 LayerImpl* layer_hit_by_point, |
575 bool* scroll_on_main_thread, | 569 bool* scroll_on_main_thread, |
576 bool* optional_has_ancestor_scroll_handler) const; | 570 bool* optional_has_ancestor_scroll_handler) const; |
577 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, | 571 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, |
578 LayerImpl* layer_impl); | 572 LayerImpl* layer_impl); |
579 void StartScrollbarFadeRecursive(LayerImpl* layer); | 573 void StartScrollbarFadeRecursive(LayerImpl* layer); |
580 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, | 574 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, |
581 bool zero_budget); | 575 bool zero_budget); |
582 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 576 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
583 | 577 |
584 void DidInitializeVisibleTile(); | |
585 | |
586 void MarkUIResourceNotEvicted(UIResourceId uid); | 578 void MarkUIResourceNotEvicted(UIResourceId uid); |
587 | 579 |
588 void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 580 void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
589 void NotifySwapPromiseMonitorsOfForwardingToMainThread(); | 581 void NotifySwapPromiseMonitorsOfForwardingToMainThread(); |
590 | 582 |
591 typedef base::hash_map<UIResourceId, UIResourceData> | 583 typedef base::hash_map<UIResourceId, UIResourceData> |
592 UIResourceMap; | 584 UIResourceMap; |
593 UIResourceMap ui_resource_map_; | 585 UIResourceMap ui_resource_map_; |
594 | 586 |
595 // Resources that were evicted by EvictAllUIResources. Resources are removed | 587 // Resources that were evicted by EvictAllUIResources. Resources are removed |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
698 | 690 |
699 // Expected time between two begin impl frame calls. | 691 // Expected time between two begin impl frame calls. |
700 base::TimeDelta begin_impl_frame_interval_; | 692 base::TimeDelta begin_impl_frame_interval_; |
701 | 693 |
702 scoped_ptr<AnimationRegistrar> animation_registrar_; | 694 scoped_ptr<AnimationRegistrar> animation_registrar_; |
703 | 695 |
704 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 696 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
705 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 697 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
706 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 698 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
707 | 699 |
708 bool need_to_update_visible_tiles_before_draw_; | |
709 | |
710 // Optional callback to notify of new tree activations. | 700 // Optional callback to notify of new tree activations. |
711 base::Closure tree_activation_callback_; | 701 base::Closure tree_activation_callback_; |
712 | 702 |
713 SharedBitmapManager* shared_bitmap_manager_; | 703 SharedBitmapManager* shared_bitmap_manager_; |
714 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 704 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
715 int id_; | 705 int id_; |
716 | 706 |
717 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 707 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
718 | 708 |
719 std::vector<PictureLayerImpl*> picture_layers_; | 709 std::vector<PictureLayerImpl*> picture_layers_; |
720 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 710 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
721 | 711 |
722 bool requires_high_res_to_draw_; | 712 bool requires_high_res_to_draw_; |
713 bool required_for_draw_tile_is_top_of_raster_queue_; | |
723 | 714 |
724 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 715 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
725 }; | 716 }; |
726 | 717 |
727 } // namespace cc | 718 } // namespace cc |
728 | 719 |
729 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 720 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |