| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 LayerImpl* layer_hit_by_point, | 558 LayerImpl* layer_hit_by_point, |
| 565 bool* scroll_on_main_thread, | 559 bool* scroll_on_main_thread, |
| 566 bool* optional_has_ancestor_scroll_handler) const; | 560 bool* optional_has_ancestor_scroll_handler) const; |
| 567 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, | 561 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, |
| 568 LayerImpl* layer_impl); | 562 LayerImpl* layer_impl); |
| 569 void StartScrollbarFadeRecursive(LayerImpl* layer); | 563 void StartScrollbarFadeRecursive(LayerImpl* layer); |
| 570 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, | 564 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, |
| 571 bool zero_budget); | 565 bool zero_budget); |
| 572 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 566 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 573 | 567 |
| 574 void DidInitializeVisibleTile(); | |
| 575 | |
| 576 void MarkUIResourceNotEvicted(UIResourceId uid); | 568 void MarkUIResourceNotEvicted(UIResourceId uid); |
| 577 | 569 |
| 578 void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 570 void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
| 579 void NotifySwapPromiseMonitorsOfForwardingToMainThread(); | 571 void NotifySwapPromiseMonitorsOfForwardingToMainThread(); |
| 580 | 572 |
| 581 typedef base::hash_map<UIResourceId, UIResourceData> | 573 typedef base::hash_map<UIResourceId, UIResourceData> |
| 582 UIResourceMap; | 574 UIResourceMap; |
| 583 UIResourceMap ui_resource_map_; | 575 UIResourceMap ui_resource_map_; |
| 584 | 576 |
| 585 // Resources that were evicted by EvictAllUIResources. Resources are removed | 577 // Resources that were evicted by EvictAllUIResources. Resources are removed |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 BeginFrameArgs current_begin_frame_args_; | 679 BeginFrameArgs current_begin_frame_args_; |
| 688 | 680 |
| 689 // Expected time between two begin impl frame calls. | 681 // Expected time between two begin impl frame calls. |
| 690 base::TimeDelta begin_impl_frame_interval_; | 682 base::TimeDelta begin_impl_frame_interval_; |
| 691 | 683 |
| 692 scoped_ptr<AnimationRegistrar> animation_registrar_; | 684 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 693 | 685 |
| 694 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 686 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 695 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 687 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
| 696 | 688 |
| 697 bool need_to_update_visible_tiles_before_draw_; | |
| 698 | |
| 699 // Optional callback to notify of new tree activations. | 689 // Optional callback to notify of new tree activations. |
| 700 base::Closure tree_activation_callback_; | 690 base::Closure tree_activation_callback_; |
| 701 | 691 |
| 702 SharedBitmapManager* shared_bitmap_manager_; | 692 SharedBitmapManager* shared_bitmap_manager_; |
| 703 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 693 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 704 int id_; | 694 int id_; |
| 705 | 695 |
| 706 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 696 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
| 707 | 697 |
| 708 std::vector<PictureLayerImpl*> picture_layers_; | 698 std::vector<PictureLayerImpl*> picture_layers_; |
| 709 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 699 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
| 710 | 700 |
| 711 bool requires_high_res_to_draw_; | 701 bool requires_high_res_to_draw_; |
| 712 | 702 |
| 713 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 703 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 714 }; | 704 }; |
| 715 | 705 |
| 716 } // namespace cc | 706 } // namespace cc |
| 717 | 707 |
| 718 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 708 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |