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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 virtual void NotifyReadyToActivate() = 0; | 67 virtual void NotifyReadyToActivate() = 0; |
68 // Please call these 2 functions through | 68 // Please call these 2 functions through |
69 // LayerTreeHostImpl's SetNeedsRedraw() and SetNeedsRedrawRect(). | 69 // LayerTreeHostImpl's SetNeedsRedraw() and SetNeedsRedrawRect(). |
70 virtual void SetNeedsRedrawOnImplThread() = 0; | 70 virtual void SetNeedsRedrawOnImplThread() = 0; |
71 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 71 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
72 virtual void DidInitializeVisibleTileOnImplThread() = 0; | 72 virtual void DidInitializeVisibleTileOnImplThread() = 0; |
73 virtual void SetNeedsCommitOnImplThread() = 0; | 73 virtual void SetNeedsCommitOnImplThread() = 0; |
74 virtual void SetNeedsManageTilesOnImplThread() = 0; | 74 virtual void SetNeedsManageTilesOnImplThread() = 0; |
75 virtual void PostAnimationEventsToMainThreadOnImplThread( | 75 virtual void PostAnimationEventsToMainThreadOnImplThread( |
76 scoped_ptr<AnimationEventsVector> events, | 76 scoped_ptr<AnimationEventsVector> events, |
77 base::Time wall_clock_time) = 0; | 77 base::TimeTicks clock_time) = 0; |
78 // Returns true if resources were deleted by this call. | 78 // Returns true if resources were deleted by this call. |
79 virtual bool ReduceContentsTextureMemoryOnImplThread( | 79 virtual bool ReduceContentsTextureMemoryOnImplThread( |
80 size_t limit_bytes, | 80 size_t limit_bytes, |
81 int priority_cutoff) = 0; | 81 int priority_cutoff) = 0; |
82 virtual void SendManagedMemoryStats() = 0; | 82 virtual void SendManagedMemoryStats() = 0; |
83 virtual bool IsInsideDraw() = 0; | 83 virtual bool IsInsideDraw() = 0; |
84 virtual void RenewTreePriority() = 0; | 84 virtual void RenewTreePriority() = 0; |
85 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; | 85 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; |
86 virtual void DidActivatePendingTree() = 0; | 86 virtual void DidActivatePendingTree() = 0; |
87 virtual void DidManageTiles() = 0; | 87 virtual void DidManageTiles() = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 bool contains_incomplete_tile; | 159 bool contains_incomplete_tile; |
160 bool has_no_damage; | 160 bool has_no_damage; |
161 | 161 |
162 // RenderPassSink implementation. | 162 // RenderPassSink implementation. |
163 virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE; | 163 virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE; |
164 }; | 164 }; |
165 | 165 |
166 virtual void BeginMainFrameAborted(bool did_handle); | 166 virtual void BeginMainFrameAborted(bool did_handle); |
167 virtual void BeginCommit(); | 167 virtual void BeginCommit(); |
168 virtual void CommitComplete(); | 168 virtual void CommitComplete(); |
169 virtual void Animate(base::TimeTicks monotonic_time, | 169 virtual void Animate(base::TimeTicks monotonic_time); |
170 base::Time wall_clock_time); | |
171 virtual void UpdateAnimationState(bool start_ready_animations); | 170 virtual void UpdateAnimationState(bool start_ready_animations); |
172 void MainThreadHasStoppedFlinging(); | 171 void MainThreadHasStoppedFlinging(); |
173 void UpdateBackgroundAnimateTicking(bool should_background_tick); | 172 void UpdateBackgroundAnimateTicking(bool should_background_tick); |
174 void DidAnimateScrollOffset(); | 173 void DidAnimateScrollOffset(); |
175 void SetViewportDamage(const gfx::Rect& damage_rect); | 174 void SetViewportDamage(const gfx::Rect& damage_rect); |
176 | 175 |
177 virtual void ManageTiles(); | 176 virtual void ManageTiles(); |
178 | 177 |
179 // Returns false if problems occured preparing the frame, and we should try | 178 // Returns false if problems occured preparing the frame, and we should try |
180 // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers | 179 // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 gfx::Vector2dF current_fling_velocity() const { | 378 gfx::Vector2dF current_fling_velocity() const { |
380 return current_fling_velocity_; | 379 return current_fling_velocity_; |
381 } | 380 } |
382 | 381 |
383 bool pinch_gesture_active() const { return pinch_gesture_active_; } | 382 bool pinch_gesture_active() const { return pinch_gesture_active_; } |
384 | 383 |
385 void SetTreePriority(TreePriority priority); | 384 void SetTreePriority(TreePriority priority); |
386 | 385 |
387 void ResetCurrentFrameTimeForNextFrame(); | 386 void ResetCurrentFrameTimeForNextFrame(); |
388 virtual base::TimeTicks CurrentFrameTimeTicks(); | 387 virtual base::TimeTicks CurrentFrameTimeTicks(); |
389 base::Time CurrentFrameTime(); | |
390 | 388 |
391 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; | 389 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; |
392 | 390 |
393 scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); } | 391 scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); } |
394 scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const; | 392 scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const; |
395 scoped_ptr<base::Value> ActivationStateAsValue() const; | 393 scoped_ptr<base::Value> ActivationStateAsValue() const; |
396 | 394 |
397 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 395 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
398 | 396 |
399 virtual void CreateUIResource(UIResourceId uid, | 397 virtual void CreateUIResource(UIResourceId uid, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 protected: | 431 protected: |
434 LayerTreeHostImpl( | 432 LayerTreeHostImpl( |
435 const LayerTreeSettings& settings, | 433 const LayerTreeSettings& settings, |
436 LayerTreeHostImplClient* client, | 434 LayerTreeHostImplClient* client, |
437 Proxy* proxy, | 435 Proxy* proxy, |
438 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 436 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
439 SharedBitmapManager* manager, | 437 SharedBitmapManager* manager, |
440 int id); | 438 int id); |
441 | 439 |
442 // Virtual for testing. | 440 // Virtual for testing. |
443 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 441 virtual void AnimateLayers(base::TimeTicks monotonic_time); |
444 base::Time wall_clock_time); | |
445 | 442 |
446 // Virtual for testing. | 443 // Virtual for testing. |
447 virtual base::TimeDelta LowFrequencyAnimationInterval() const; | 444 virtual base::TimeDelta LowFrequencyAnimationInterval() const; |
448 | 445 |
449 const AnimationRegistrar::AnimationControllerMap& | 446 const AnimationRegistrar::AnimationControllerMap& |
450 active_animation_controllers() const { | 447 active_animation_controllers() const { |
451 return animation_registrar_->active_animation_controllers(); | 448 return animation_registrar_->active_animation_controllers(); |
452 } | 449 } |
453 | 450 |
454 bool manage_tiles_needed() const { return tile_priorities_dirty_; } | 451 bool manage_tiles_needed() const { return tile_priorities_dirty_; } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 void SendReleaseResourcesRecursive(LayerImpl* current); | 490 void SendReleaseResourcesRecursive(LayerImpl* current); |
494 bool EnsureRenderSurfaceLayerList(); | 491 bool EnsureRenderSurfaceLayerList(); |
495 void ClearCurrentlyScrollingLayer(); | 492 void ClearCurrentlyScrollingLayer(); |
496 | 493 |
497 bool HandleMouseOverScrollbar(LayerImpl* layer_impl, | 494 bool HandleMouseOverScrollbar(LayerImpl* layer_impl, |
498 const gfx::PointF& device_viewport_point); | 495 const gfx::PointF& device_viewport_point); |
499 | 496 |
500 void AnimateScrollbarsRecursive(LayerImpl* layer, | 497 void AnimateScrollbarsRecursive(LayerImpl* layer, |
501 base::TimeTicks time); | 498 base::TimeTicks time); |
502 | 499 |
503 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; | 500 void UpdateCurrentFrameTime(base::TimeTicks* ticks) const; |
504 | 501 |
505 LayerImpl* FindScrollLayerForDeviceViewportPoint( | 502 LayerImpl* FindScrollLayerForDeviceViewportPoint( |
506 const gfx::PointF& device_viewport_point, | 503 const gfx::PointF& device_viewport_point, |
507 InputHandler::ScrollInputType type, | 504 InputHandler::ScrollInputType type, |
508 LayerImpl* layer_hit_by_point, | 505 LayerImpl* layer_hit_by_point, |
509 bool* scroll_on_main_thread) const; | 506 bool* scroll_on_main_thread) const; |
510 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, | 507 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, |
511 LayerImpl* layer_impl); | 508 LayerImpl* layer_impl); |
512 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); | 509 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); |
513 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, | 510 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 565 |
569 gfx::Vector2dF accumulated_root_overscroll_; | 566 gfx::Vector2dF accumulated_root_overscroll_; |
570 gfx::Vector2dF current_fling_velocity_; | 567 gfx::Vector2dF current_fling_velocity_; |
571 | 568 |
572 bool pinch_gesture_active_; | 569 bool pinch_gesture_active_; |
573 bool pinch_gesture_end_should_clear_scrolling_layer_; | 570 bool pinch_gesture_end_should_clear_scrolling_layer_; |
574 gfx::Point previous_pinch_anchor_; | 571 gfx::Point previous_pinch_anchor_; |
575 | 572 |
576 // This is set by AnimateLayers() and used by UpdateAnimationState() | 573 // This is set by AnimateLayers() and used by UpdateAnimationState() |
577 // when sending animation events to the main thread. | 574 // when sending animation events to the main thread. |
578 base::Time last_animation_time_; | 575 base::TimeTicks last_animation_time_; |
579 | 576 |
580 scoped_ptr<TopControlsManager> top_controls_manager_; | 577 scoped_ptr<TopControlsManager> top_controls_manager_; |
581 | 578 |
582 scoped_ptr<PageScaleAnimation> page_scale_animation_; | 579 scoped_ptr<PageScaleAnimation> page_scale_animation_; |
583 | 580 |
584 // This is used for ticking animations slowly when hidden. | 581 // This is used for ticking animations slowly when hidden. |
585 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_; | 582 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_; |
586 | 583 |
587 scoped_ptr<FrameRateCounter> fps_counter_; | 584 scoped_ptr<FrameRateCounter> fps_counter_; |
588 scoped_ptr<PaintTimeCounter> paint_time_counter_; | 585 scoped_ptr<PaintTimeCounter> paint_time_counter_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // scrollable size.) | 627 // scrollable size.) |
631 gfx::Transform external_transform_; | 628 gfx::Transform external_transform_; |
632 gfx::Rect external_viewport_; | 629 gfx::Rect external_viewport_; |
633 gfx::Rect external_clip_; | 630 gfx::Rect external_clip_; |
634 bool device_viewport_valid_for_tile_management_; | 631 bool device_viewport_valid_for_tile_management_; |
635 bool external_stencil_test_enabled_; | 632 bool external_stencil_test_enabled_; |
636 | 633 |
637 gfx::Rect viewport_damage_rect_; | 634 gfx::Rect viewport_damage_rect_; |
638 | 635 |
639 base::TimeTicks current_frame_timeticks_; | 636 base::TimeTicks current_frame_timeticks_; |
640 base::Time current_frame_time_; | |
641 | 637 |
642 scoped_ptr<AnimationRegistrar> animation_registrar_; | 638 scoped_ptr<AnimationRegistrar> animation_registrar_; |
643 | 639 |
644 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 640 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
645 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 641 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
646 | 642 |
647 bool need_to_update_visible_tiles_before_draw_; | 643 bool need_to_update_visible_tiles_before_draw_; |
648 #ifndef NDEBUG | 644 #ifndef NDEBUG |
649 bool did_lose_called_; | 645 bool did_lose_called_; |
650 #endif | 646 #endif |
651 | 647 |
652 // Optional callback to notify of new tree activations. | 648 // Optional callback to notify of new tree activations. |
653 base::Closure tree_activation_callback_; | 649 base::Closure tree_activation_callback_; |
654 | 650 |
655 SharedBitmapManager* shared_bitmap_manager_; | 651 SharedBitmapManager* shared_bitmap_manager_; |
656 int id_; | 652 int id_; |
657 | 653 |
658 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 654 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
659 | 655 |
660 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 656 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
661 }; | 657 }; |
662 | 658 |
663 } // namespace cc | 659 } // namespace cc |
664 | 660 |
665 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 661 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |