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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <bitset> | 10 #include <bitset> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "cc/base/cc_export.h" | 21 #include "cc/base/cc_export.h" |
22 #include "cc/base/synced_property.h" | 22 #include "cc/base/synced_property.h" |
23 #include "cc/debug/micro_benchmark_controller_impl.h" | 23 #include "cc/debug/micro_benchmark_controller_impl.h" |
24 #include "cc/input/input_handler.h" | 24 #include "cc/input/input_handler.h" |
25 #include "cc/input/scrollbar_animation_controller.h" | 25 #include "cc/input/scrollbar_animation_controller.h" |
26 #include "cc/input/top_controls_manager_client.h" | 26 #include "cc/input/top_controls_manager_client.h" |
27 #include "cc/layers/layer_collections.h" | 27 #include "cc/layers/layer_collections.h" |
28 #include "cc/layers/render_pass_sink.h" | 28 #include "cc/layers/render_pass_sink.h" |
29 #include "cc/output/begin_frame_args.h" | 29 #include "cc/output/begin_frame_args.h" |
30 #include "cc/output/context_cache_controller.h" | 30 #include "cc/output/context_cache_controller.h" |
31 #include "cc/output/delegating_renderer.h" | |
32 #include "cc/output/managed_memory_policy.h" | 31 #include "cc/output/managed_memory_policy.h" |
33 #include "cc/output/output_surface_client.h" | 32 #include "cc/output/output_surface_client.h" |
34 #include "cc/quads/render_pass.h" | 33 #include "cc/quads/render_pass.h" |
35 #include "cc/resources/resource_provider.h" | 34 #include "cc/resources/resource_provider.h" |
36 #include "cc/resources/ui_resource_client.h" | 35 #include "cc/resources/ui_resource_client.h" |
37 #include "cc/scheduler/begin_frame_tracker.h" | 36 #include "cc/scheduler/begin_frame_tracker.h" |
38 #include "cc/scheduler/commit_earlyout_reason.h" | 37 #include "cc/scheduler/commit_earlyout_reason.h" |
39 #include "cc/scheduler/draw_result.h" | 38 #include "cc/scheduler/draw_result.h" |
40 #include "cc/scheduler/video_frame_controller.h" | 39 #include "cc/scheduler/video_frame_controller.h" |
41 #include "cc/tiles/image_decode_controller.h" | 40 #include "cc/tiles/image_decode_controller.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // Implementation. | 390 // Implementation. |
392 int id() const { return id_; } | 391 int id() const { return id_; } |
393 bool CanDraw() const; | 392 bool CanDraw() const; |
394 OutputSurface* output_surface() const { return output_surface_; } | 393 OutputSurface* output_surface() const { return output_surface_; } |
395 void ReleaseOutputSurface(); | 394 void ReleaseOutputSurface(); |
396 | 395 |
397 std::string LayerTreeAsJson() const; | 396 std::string LayerTreeAsJson() const; |
398 | 397 |
399 int RequestedMSAASampleCount() const; | 398 int RequestedMSAASampleCount() const; |
400 | 399 |
| 400 // TODO(danakj): Rename this, there is no renderer. |
401 virtual bool InitializeRenderer(OutputSurface* output_surface); | 401 virtual bool InitializeRenderer(OutputSurface* output_surface); |
402 TileManager* tile_manager() { return &tile_manager_; } | 402 TileManager* tile_manager() { return &tile_manager_; } |
403 | 403 |
404 void SetHasGpuRasterizationTrigger(bool flag); | 404 void SetHasGpuRasterizationTrigger(bool flag); |
405 void SetContentIsSuitableForGpuRasterization(bool flag); | 405 void SetContentIsSuitableForGpuRasterization(bool flag); |
406 bool CanUseGpuRasterization(); | 406 bool CanUseGpuRasterization(); |
407 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } | 407 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
408 bool use_msaa() const { return use_msaa_; } | 408 bool use_msaa() const { return use_msaa_; } |
409 | 409 |
410 GpuRasterizationStatus gpu_rasterization_status() const { | 410 GpuRasterizationStatus gpu_rasterization_status() const { |
411 return gpu_rasterization_status_; | 411 return gpu_rasterization_status_; |
412 } | 412 } |
413 | 413 |
414 bool create_low_res_tiling() const { | 414 bool create_low_res_tiling() const { |
415 return settings_.create_low_res_tiling && !use_gpu_rasterization_; | 415 return settings_.create_low_res_tiling && !use_gpu_rasterization_; |
416 } | 416 } |
417 ResourcePool* resource_pool() { return resource_pool_.get(); } | 417 ResourcePool* resource_pool() { return resource_pool_.get(); } |
418 DelegatingRenderer* renderer() { return renderer_.get(); } | |
419 ImageDecodeController* image_decode_controller() { | 418 ImageDecodeController* image_decode_controller() { |
420 return image_decode_controller_.get(); | 419 return image_decode_controller_.get(); |
421 } | 420 } |
422 | 421 |
423 virtual void WillBeginImplFrame(const BeginFrameArgs& args); | 422 virtual void WillBeginImplFrame(const BeginFrameArgs& args); |
424 virtual void DidFinishImplFrame(); | 423 virtual void DidFinishImplFrame(); |
425 void DidModifyTilePriorities(); | 424 void DidModifyTilePriorities(); |
426 | 425 |
427 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 426 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
428 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 427 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 }; | 539 }; |
541 | 540 |
542 // Returns the amount of delta that can be applied to scroll_node, taking | 541 // Returns the amount of delta that can be applied to scroll_node, taking |
543 // page scale into account. | 542 // page scale into account. |
544 gfx::Vector2dF ComputeScrollDelta(ScrollNode* scroll_node, | 543 gfx::Vector2dF ComputeScrollDelta(ScrollNode* scroll_node, |
545 const gfx::Vector2dF& delta); | 544 const gfx::Vector2dF& delta); |
546 | 545 |
547 void ScheduleMicroBenchmark(std::unique_ptr<MicroBenchmarkImpl> benchmark); | 546 void ScheduleMicroBenchmark(std::unique_ptr<MicroBenchmarkImpl> benchmark); |
548 | 547 |
549 CompositorFrameMetadata MakeCompositorFrameMetadata() const; | 548 CompositorFrameMetadata MakeCompositorFrameMetadata() const; |
550 // Viewport rectangle and clip in nonflipped window space. These rects | 549 // Viewport rectangle and clip in device space. These rects are used to |
551 // should only be used by Renderer subclasses to populate glViewport/glClip | 550 // prioritize raster and determine what is submitted in a CompositorFrame. |
552 // and their software-mode equivalents. | |
553 gfx::Rect DeviceViewport() const; | 551 gfx::Rect DeviceViewport() const; |
554 | 552 |
555 // When a SwapPromiseMonitor is created on the impl thread, it calls | 553 // When a SwapPromiseMonitor is created on the impl thread, it calls |
556 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. | 554 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. |
557 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() | 555 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() |
558 // to unregister itself. | 556 // to unregister itself. |
559 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); | 557 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
560 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); | 558 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
561 | 559 |
562 // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for | 560 // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 633 |
636 BeginFrameTracker current_begin_frame_tracker_; | 634 BeginFrameTracker current_begin_frame_tracker_; |
637 | 635 |
638 private: | 636 private: |
639 gfx::Vector2dF ScrollNodeWithViewportSpaceDelta( | 637 gfx::Vector2dF ScrollNodeWithViewportSpaceDelta( |
640 ScrollNode* scroll_node, | 638 ScrollNode* scroll_node, |
641 const gfx::PointF& viewport_point, | 639 const gfx::PointF& viewport_point, |
642 const gfx::Vector2dF& viewport_delta, | 640 const gfx::Vector2dF& viewport_delta, |
643 ScrollTree* scroll_tree); | 641 ScrollTree* scroll_tree); |
644 | 642 |
645 void CreateAndSetRenderer(); | |
646 void CleanUpTileManagerAndUIResources(); | 643 void CleanUpTileManagerAndUIResources(); |
647 void CreateTileManagerResources(); | 644 void CreateTileManagerResources(); |
648 void ReleaseTreeResources(); | 645 void ReleaseTreeResources(); |
649 void RecreateTreeResources(); | 646 void RecreateTreeResources(); |
650 | 647 |
651 void AnimateInternal(bool active_tree); | 648 void AnimateInternal(bool active_tree); |
652 | 649 |
653 // Returns true if status changed. | 650 // Returns true if status changed. |
654 bool UpdateGpuRasterizationStatus(); | 651 bool UpdateGpuRasterizationStatus(); |
655 void UpdateTreeResourcesForGpuRasterizationIfNeeded(); | 652 void UpdateTreeResourcesForGpuRasterizationIfNeeded(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 std::unique_ptr<ResourceProvider> resource_provider_; | 733 std::unique_ptr<ResourceProvider> resource_provider_; |
737 bool need_update_gpu_rasterization_status_; | 734 bool need_update_gpu_rasterization_status_; |
738 bool content_is_suitable_for_gpu_rasterization_; | 735 bool content_is_suitable_for_gpu_rasterization_; |
739 bool has_gpu_rasterization_trigger_; | 736 bool has_gpu_rasterization_trigger_; |
740 bool use_gpu_rasterization_; | 737 bool use_gpu_rasterization_; |
741 bool use_msaa_; | 738 bool use_msaa_; |
742 GpuRasterizationStatus gpu_rasterization_status_; | 739 GpuRasterizationStatus gpu_rasterization_status_; |
743 std::unique_ptr<RasterBufferProvider> raster_buffer_provider_; | 740 std::unique_ptr<RasterBufferProvider> raster_buffer_provider_; |
744 std::unique_ptr<TileTaskManager> tile_task_manager_; | 741 std::unique_ptr<TileTaskManager> tile_task_manager_; |
745 std::unique_ptr<ResourcePool> resource_pool_; | 742 std::unique_ptr<ResourcePool> resource_pool_; |
746 std::unique_ptr<DelegatingRenderer> renderer_; | |
747 std::unique_ptr<ImageDecodeController> image_decode_controller_; | 743 std::unique_ptr<ImageDecodeController> image_decode_controller_; |
748 | 744 |
749 GlobalStateThatImpactsTilePriority global_tile_state_; | 745 GlobalStateThatImpactsTilePriority global_tile_state_; |
750 | 746 |
751 // Tree currently being drawn. | 747 // Tree currently being drawn. |
752 std::unique_ptr<LayerTreeImpl> active_tree_; | 748 std::unique_ptr<LayerTreeImpl> active_tree_; |
753 | 749 |
754 // In impl-side painting mode, tree with possibly incomplete rasterized | 750 // In impl-side painting mode, tree with possibly incomplete rasterized |
755 // content. May be promoted to active by ActivatePendingTree(). | 751 // content. May be promoted to active by ActivatePendingTree(). |
756 std::unique_ptr<LayerTreeImpl> pending_tree_; | 752 std::unique_ptr<LayerTreeImpl> pending_tree_; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 | 847 |
852 std::unique_ptr<PendingTreeDurationHistogramTimer> | 848 std::unique_ptr<PendingTreeDurationHistogramTimer> |
853 pending_tree_duration_timer_; | 849 pending_tree_duration_timer_; |
854 | 850 |
855 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 851 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
856 }; | 852 }; |
857 | 853 |
858 } // namespace cc | 854 } // namespace cc |
859 | 855 |
860 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 856 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |