| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void SetNeedsAnimate() override; | 167 void SetNeedsAnimate() override; |
| 168 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, | 168 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
| 169 InputHandler::ScrollInputType type) override; | 169 InputHandler::ScrollInputType type) override; |
| 170 bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override; | 170 bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override; |
| 171 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; | 171 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; |
| 172 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 172 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
| 173 ui::LatencyInfo* latency) override; | 173 ui::LatencyInfo* latency) override; |
| 174 ScrollElasticityHelper* CreateScrollElasticityHelper() override; | 174 ScrollElasticityHelper* CreateScrollElasticityHelper() override; |
| 175 | 175 |
| 176 // TopControlsManagerClient implementation. | 176 // TopControlsManagerClient implementation. |
| 177 void SetControlsTopOffset(float offset) override; | 177 float TopControlsHeight() const override; |
| 178 float ControlsTopOffset() const override; | 178 void SetCurrentTopControlsShownRatio(float offset) override; |
| 179 float CurrentTopControlsShownRatio() const override; |
| 179 void DidChangeTopControlsPosition() override; | 180 void DidChangeTopControlsPosition() override; |
| 180 bool HaveRootScrollLayer() const override; | 181 bool HaveRootScrollLayer() const override; |
| 181 | 182 |
| 183 void UpdateViewportContainerSizes(); |
| 184 |
| 182 struct CC_EXPORT FrameData : public RenderPassSink { | 185 struct CC_EXPORT FrameData : public RenderPassSink { |
| 183 FrameData(); | 186 FrameData(); |
| 184 ~FrameData() override; | 187 ~FrameData() override; |
| 185 void AsValueInto(base::debug::TracedValue* value) const; | 188 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 186 | 189 |
| 187 std::vector<gfx::Rect> occluding_screen_space_rects; | 190 std::vector<gfx::Rect> occluding_screen_space_rects; |
| 188 std::vector<gfx::Rect> non_occluding_screen_space_rects; | 191 std::vector<gfx::Rect> non_occluding_screen_space_rects; |
| 189 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; | 192 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; |
| 190 RenderPassList render_passes; | 193 RenderPassList render_passes; |
| 191 RenderPassIdHashMap render_passes_by_id; | 194 RenderPassIdHashMap render_passes_by_id; |
| 192 const LayerImplList* render_surface_layer_list; | 195 const LayerImplList* render_surface_layer_list; |
| 193 LayerImplList will_draw_layers; | 196 LayerImplList will_draw_layers; |
| 194 bool has_no_damage; | 197 bool has_no_damage; |
| 195 | 198 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 void NotifyReadyToActivate() override; | 250 void NotifyReadyToActivate() override; |
| 248 void NotifyReadyToDraw() override; | 251 void NotifyReadyToDraw() override; |
| 249 void NotifyTileStateChanged(const Tile* tile) override; | 252 void NotifyTileStateChanged(const Tile* tile) override; |
| 250 scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( | 253 scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( |
| 251 TreePriority tree_priority, | 254 TreePriority tree_priority, |
| 252 RasterTilePriorityQueue::Type type) override; | 255 RasterTilePriorityQueue::Type type) override; |
| 253 scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( | 256 scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( |
| 254 TreePriority tree_priority) override; | 257 TreePriority tree_priority) override; |
| 255 void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override; | 258 void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override; |
| 256 | 259 |
| 257 // Returns existing picture layers. | |
| 258 // TODO(vmpstr): Remove this, it's only used in tests. | |
| 259 const std::vector<PictureLayerImpl*>& GetPictureLayers() const; | |
| 260 | |
| 261 // ScrollbarAnimationControllerClient implementation. | 260 // ScrollbarAnimationControllerClient implementation. |
| 262 void PostDelayedScrollbarFade(const base::Closure& start_fade, | 261 void PostDelayedScrollbarFade(const base::Closure& start_fade, |
| 263 base::TimeDelta delay) override; | 262 base::TimeDelta delay) override; |
| 264 void SetNeedsScrollbarAnimationFrame() override; | 263 void SetNeedsScrollbarAnimationFrame() override; |
| 265 | 264 |
| 266 // OutputSurfaceClient implementation. | 265 // OutputSurfaceClient implementation. |
| 267 void DeferredInitialize() override; | 266 void DeferredInitialize() override; |
| 268 void ReleaseGL() override; | 267 void ReleaseGL() override; |
| 269 void CommitVSyncParameters(base::TimeTicks timebase, | 268 void CommitVSyncParameters(base::TimeTicks timebase, |
| 270 base::TimeDelta interval) override; | 269 base::TimeDelta interval) override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 void set_gpu_rasterization_status( | 306 void set_gpu_rasterization_status( |
| 308 GpuRasterizationStatus gpu_rasterization_status) { | 307 GpuRasterizationStatus gpu_rasterization_status) { |
| 309 gpu_rasterization_status_ = gpu_rasterization_status; | 308 gpu_rasterization_status_ = gpu_rasterization_status; |
| 310 } | 309 } |
| 311 | 310 |
| 312 bool create_low_res_tiling() const { | 311 bool create_low_res_tiling() const { |
| 313 return settings_.create_low_res_tiling && !use_gpu_rasterization_; | 312 return settings_.create_low_res_tiling && !use_gpu_rasterization_; |
| 314 } | 313 } |
| 315 ResourcePool* resource_pool() { return resource_pool_.get(); } | 314 ResourcePool* resource_pool() { return resource_pool_.get(); } |
| 316 Renderer* renderer() { return renderer_.get(); } | 315 Renderer* renderer() { return renderer_.get(); } |
| 316 Rasterizer* rasterizer() { return rasterizer_.get(); } |
| 317 const RendererCapabilitiesImpl& GetRendererCapabilities() const; | 317 const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
| 318 | 318 |
| 319 virtual bool SwapBuffers(const FrameData& frame); | 319 virtual bool SwapBuffers(const FrameData& frame); |
| 320 virtual void WillBeginImplFrame(const BeginFrameArgs& args); | 320 virtual void WillBeginImplFrame(const BeginFrameArgs& args); |
| 321 void DidModifyTilePriorities(); | 321 void DidModifyTilePriorities(); |
| 322 | 322 |
| 323 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 323 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
| 324 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 324 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
| 325 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 325 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
| 326 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 326 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); | 443 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); |
| 444 void ResetCurrentBeginFrameArgsForNextFrame(); | 444 void ResetCurrentBeginFrameArgsForNextFrame(); |
| 445 virtual BeginFrameArgs CurrentBeginFrameArgs() const; | 445 virtual BeginFrameArgs CurrentBeginFrameArgs() const; |
| 446 | 446 |
| 447 // Expected time between two begin impl frame calls. | 447 // Expected time between two begin impl frame calls. |
| 448 base::TimeDelta begin_impl_frame_interval() const { | 448 base::TimeDelta begin_impl_frame_interval() const { |
| 449 return begin_impl_frame_interval_; | 449 return begin_impl_frame_interval_; |
| 450 } | 450 } |
| 451 | 451 |
| 452 void AsValueInto(base::debug::TracedValue* value) const; | 452 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 453 void AsValueWithFrameInto(FrameData* frame, | 453 void AsValueWithFrameInto(FrameData* frame, |
| 454 base::debug::TracedValue* value) const; | 454 base::trace_event::TracedValue* value) const; |
| 455 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 455 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 456 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame( | 456 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValueWithFrame( |
| 457 FrameData* frame) const; | 457 FrameData* frame) const; |
| 458 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue() | 458 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 459 const; | 459 ActivationStateAsValue() const; |
| 460 void ActivationStateAsValueInto(base::debug::TracedValue* value) const; | 460 void ActivationStateAsValueInto(base::trace_event::TracedValue* value) const; |
| 461 | 461 |
| 462 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 462 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
| 463 | 463 |
| 464 virtual void CreateUIResource(UIResourceId uid, | 464 virtual void CreateUIResource(UIResourceId uid, |
| 465 const UIResourceBitmap& bitmap); | 465 const UIResourceBitmap& bitmap); |
| 466 // Deletes a UI resource. May safely be called more than once. | 466 // Deletes a UI resource. May safely be called more than once. |
| 467 virtual void DeleteUIResource(UIResourceId uid); | 467 virtual void DeleteUIResource(UIResourceId uid); |
| 468 void EvictAllUIResources(); | 468 void EvictAllUIResources(); |
| 469 bool EvictedUIResourcesExist() const; | 469 bool EvictedUIResourcesExist() const; |
| 470 | 470 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 488 gfx::Rect DeviceViewport() const; | 488 gfx::Rect DeviceViewport() const; |
| 489 gfx::Rect DeviceClip() const; | 489 gfx::Rect DeviceClip() const; |
| 490 | 490 |
| 491 // When a SwapPromiseMonitor is created on the impl thread, it calls | 491 // When a SwapPromiseMonitor is created on the impl thread, it calls |
| 492 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. | 492 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. |
| 493 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() | 493 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() |
| 494 // to unregister itself. | 494 // to unregister itself. |
| 495 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); | 495 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
| 496 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); | 496 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
| 497 | 497 |
| 498 void RegisterPictureLayerImpl(PictureLayerImpl* layer); | |
| 499 void UnregisterPictureLayerImpl(PictureLayerImpl* layer); | |
| 500 | |
| 501 void GetPictureLayerImplPairs(std::vector<PictureLayerImpl::Pair>* layers, | 498 void GetPictureLayerImplPairs(std::vector<PictureLayerImpl::Pair>* layers, |
| 502 bool need_valid_tile_priorities) const; | 499 bool need_valid_tile_priorities) const; |
| 503 | 500 |
| 504 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } | 501 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } |
| 505 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } | 502 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } |
| 506 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } | 503 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } |
| 507 | 504 |
| 508 // Only valid for synchronous (non-scheduled) single-threaded case. | 505 // Only valid for synchronous (non-scheduled) single-threaded case. |
| 509 void SynchronouslyInitializeAllTiles(); | 506 void SynchronouslyInitializeAllTiles(); |
| 510 | 507 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 523 protected: | 520 protected: |
| 524 LayerTreeHostImpl( | 521 LayerTreeHostImpl( |
| 525 const LayerTreeSettings& settings, | 522 const LayerTreeSettings& settings, |
| 526 LayerTreeHostImplClient* client, | 523 LayerTreeHostImplClient* client, |
| 527 Proxy* proxy, | 524 Proxy* proxy, |
| 528 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 525 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 529 SharedBitmapManager* shared_bitmap_manager, | 526 SharedBitmapManager* shared_bitmap_manager, |
| 530 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 527 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 531 int id); | 528 int id); |
| 532 | 529 |
| 533 void UpdateViewportContainerSizes(); | |
| 534 | 530 |
| 535 // Virtual for testing. | 531 // Virtual for testing. |
| 536 virtual void AnimateLayers(base::TimeTicks monotonic_time); | 532 virtual void AnimateLayers(base::TimeTicks monotonic_time); |
| 537 const AnimationRegistrar::AnimationControllerMap& | 533 const AnimationRegistrar::AnimationControllerMap& |
| 538 active_animation_controllers() const { | 534 active_animation_controllers() const { |
| 539 return animation_registrar_->active_animation_controllers(); | 535 return animation_registrar_->active_animation_controllers(); |
| 540 } | 536 } |
| 541 | 537 |
| 542 LayerTreeHostImplClient* client_; | 538 LayerTreeHostImplClient* client_; |
| 543 Proxy* proxy_; | 539 Proxy* proxy_; |
| 544 | 540 |
| 545 private: | 541 private: |
| 546 void CreateAndSetRenderer(); | 542 void CreateAndSetRenderer(); |
| 547 void CreateAndSetTileManager(); | 543 void CreateAndSetTileManager(); |
| 548 void DestroyTileManager(); | 544 void DestroyTileManager(); |
| 549 void ReleaseTreeResources(); | 545 void ReleaseTreeResources(); |
| 550 void RecreateTreeResources(); | 546 void RecreateTreeResources(); |
| 551 void EnforceZeroBudget(bool zero_budget); | 547 void EnforceZeroBudget(bool zero_budget); |
| 552 | 548 |
| 553 bool UsePendingTreeForSync() const; | |
| 554 bool IsSynchronousSingleThreaded() const; | 549 bool IsSynchronousSingleThreaded() const; |
| 555 | 550 |
| 556 // Scroll by preferring to move the outer viewport first, only moving the | 551 // Scroll by preferring to move the outer viewport first, only moving the |
| 557 // inner if the outer is at its scroll extents. | 552 // inner if the outer is at its scroll extents. |
| 558 void ScrollViewportBy(gfx::Vector2dF scroll_delta); | 553 void ScrollViewportBy(gfx::Vector2dF scroll_delta); |
| 559 // Scroll by preferring to move the inner viewport first, only moving the | 554 // Scroll by preferring to move the inner viewport first, only moving the |
| 560 // outer if the inner is at its scroll extents. | 555 // outer if the inner is at its scroll extents. |
| 561 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); | 556 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); |
| 562 void AnimatePageScale(base::TimeTicks monotonic_time); | 557 void AnimatePageScale(base::TimeTicks monotonic_time); |
| 563 void AnimateScrollbars(base::TimeTicks monotonic_time); | 558 void AnimateScrollbars(base::TimeTicks monotonic_time); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 720 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
| 726 | 721 |
| 727 // Optional callback to notify of new tree activations. | 722 // Optional callback to notify of new tree activations. |
| 728 base::Closure tree_activation_callback_; | 723 base::Closure tree_activation_callback_; |
| 729 | 724 |
| 730 SharedBitmapManager* shared_bitmap_manager_; | 725 SharedBitmapManager* shared_bitmap_manager_; |
| 731 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 726 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 732 int id_; | 727 int id_; |
| 733 | 728 |
| 734 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 729 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
| 735 | |
| 736 std::vector<PictureLayerImpl*> picture_layers_; | |
| 737 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 730 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
| 738 | 731 |
| 739 bool requires_high_res_to_draw_; | 732 bool requires_high_res_to_draw_; |
| 740 bool is_likely_to_require_a_draw_; | 733 bool is_likely_to_require_a_draw_; |
| 741 | 734 |
| 742 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 735 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
| 743 | 736 |
| 744 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 737 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 745 }; | 738 }; |
| 746 | 739 |
| 747 } // namespace cc | 740 } // namespace cc |
| 748 | 741 |
| 749 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 742 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |