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