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