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. |
229 const gfx::Rect ViewportRectForTilePriority() const; | 224 const gfx::Rect ViewportRectForTilePriority() const; |
230 | 225 |
231 // RendererClient implementation. | 226 // RendererClient implementation. |
232 void SetFullRootLayerDamage() override; | 227 void SetFullRootLayerDamage() override; |
233 | 228 |
234 // TileManagerClient implementation. | 229 // TileManagerClient implementation. |
235 const std::vector<PictureLayerImpl*>& GetPictureLayers() const override; | 230 const std::vector<PictureLayerImpl*>& GetPictureLayers() const override; |
236 void NotifyReadyToActivate() override; | 231 void NotifyReadyToActivate() override; |
237 void NotifyTileStateChanged(const Tile* tile) override; | 232 void NotifyTileStateChanged(const Tile* tile) override; |
238 void BuildRasterQueue(RasterTilePriorityQueue* queue, | 233 void BuildRasterQueue(RasterTilePriorityQueue* queue, |
239 TreePriority tree_priority) override; | 234 TreePriority tree_priority) override; |
| 235 void FinishedRasterQueue() override; |
240 void BuildEvictionQueue(EvictionTilePriorityQueue* queue, | 236 void BuildEvictionQueue(EvictionTilePriorityQueue* queue, |
241 TreePriority tree_priority) override; | 237 TreePriority tree_priority) override; |
242 | 238 |
243 // ScrollbarAnimationControllerClient implementation. | 239 // ScrollbarAnimationControllerClient implementation. |
244 void PostDelayedScrollbarFade(const base::Closure& start_fade, | 240 void PostDelayedScrollbarFade(const base::Closure& start_fade, |
245 base::TimeDelta delay) override; | 241 base::TimeDelta delay) override; |
246 void SetNeedsScrollbarAnimationFrame() override; | 242 void SetNeedsScrollbarAnimationFrame() override; |
247 | 243 |
248 // OutputSurfaceClient implementation. | 244 // OutputSurfaceClient implementation. |
249 void DeferredInitialize() override; | 245 void DeferredInitialize() override; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 295 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
300 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 296 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
301 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 297 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
302 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } | 298 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } |
303 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 299 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
304 // Returns the tree LTH synchronizes with. | 300 // Returns the tree LTH synchronizes with. |
305 LayerTreeImpl* sync_tree() { | 301 LayerTreeImpl* sync_tree() { |
306 return pending_tree_ ? pending_tree_.get() : active_tree_.get(); | 302 return pending_tree_ ? pending_tree_.get() : active_tree_.get(); |
307 } | 303 } |
308 virtual void CreatePendingTree(); | 304 virtual void CreatePendingTree(); |
309 virtual void UpdateVisibleTiles(); | |
310 virtual void ActivateSyncTree(); | 305 virtual void ActivateSyncTree(); |
311 | 306 |
312 // Shortcuts to layers on the active tree. | 307 // Shortcuts to layers on the active tree. |
313 LayerImpl* RootLayer() const; | 308 LayerImpl* RootLayer() const; |
314 LayerImpl* InnerViewportScrollLayer() const; | 309 LayerImpl* InnerViewportScrollLayer() const; |
315 LayerImpl* OuterViewportScrollLayer() const; | 310 LayerImpl* OuterViewportScrollLayer() const; |
316 LayerImpl* CurrentlyScrollingLayer() const; | 311 LayerImpl* CurrentlyScrollingLayer() const; |
317 | 312 |
318 int scroll_layer_id_when_mouse_over_scrollbar() const { | 313 int scroll_layer_id_when_mouse_over_scrollbar() const { |
319 return scroll_layer_id_when_mouse_over_scrollbar_; | 314 return scroll_layer_id_when_mouse_over_scrollbar_; |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 690 |
696 // Expected time between two begin impl frame calls. | 691 // Expected time between two begin impl frame calls. |
697 base::TimeDelta begin_impl_frame_interval_; | 692 base::TimeDelta begin_impl_frame_interval_; |
698 | 693 |
699 scoped_ptr<AnimationRegistrar> animation_registrar_; | 694 scoped_ptr<AnimationRegistrar> animation_registrar_; |
700 | 695 |
701 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 696 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
702 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 697 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
703 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 698 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
704 | 699 |
705 bool need_to_update_visible_tiles_before_draw_; | |
706 | |
707 // Optional callback to notify of new tree activations. | 700 // Optional callback to notify of new tree activations. |
708 base::Closure tree_activation_callback_; | 701 base::Closure tree_activation_callback_; |
709 | 702 |
710 SharedBitmapManager* shared_bitmap_manager_; | 703 SharedBitmapManager* shared_bitmap_manager_; |
711 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 704 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
712 int id_; | 705 int id_; |
713 | 706 |
714 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 707 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
715 | 708 |
716 std::vector<PictureLayerImpl*> picture_layers_; | 709 std::vector<PictureLayerImpl*> picture_layers_; |
717 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 710 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
718 | 711 |
719 bool requires_high_res_to_draw_; | 712 bool requires_high_res_to_draw_; |
| 713 bool active_visible_tile_is_top_of_raster_queue_; |
720 | 714 |
721 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 715 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
722 }; | 716 }; |
723 | 717 |
724 } // namespace cc | 718 } // namespace cc |
725 | 719 |
726 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 720 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |