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> | |
9 #include <set> | 8 #include <set> |
10 #include <string> | 9 #include <string> |
11 #include <vector> | 10 #include <vector> |
12 | 11 |
13 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
14 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/time/time.h" | 15 #include "base/time/time.h" |
17 #include "cc/animation/animation_events.h" | 16 #include "cc/animation/animation_events.h" |
18 #include "cc/animation/animation_registrar.h" | 17 #include "cc/animation/animation_registrar.h" |
19 #include "cc/animation/scrollbar_animation_controller.h" | 18 #include "cc/animation/scrollbar_animation_controller.h" |
20 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
21 #include "cc/base/synced_property.h" | 20 #include "cc/base/synced_property.h" |
22 #include "cc/debug/micro_benchmark_controller_impl.h" | 21 #include "cc/debug/micro_benchmark_controller_impl.h" |
23 #include "cc/input/input_handler.h" | 22 #include "cc/input/input_handler.h" |
24 #include "cc/input/layer_scroll_offset_delegate.h" | 23 #include "cc/input/layer_scroll_offset_delegate.h" |
25 #include "cc/input/top_controls_manager_client.h" | 24 #include "cc/input/top_controls_manager_client.h" |
26 #include "cc/layers/layer_lists.h" | 25 #include "cc/layers/layer_lists.h" |
27 #include "cc/layers/render_pass_sink.h" | 26 #include "cc/layers/render_pass_sink.h" |
28 #include "cc/output/begin_frame_args.h" | 27 #include "cc/output/begin_frame_args.h" |
29 #include "cc/output/managed_memory_policy.h" | 28 #include "cc/output/managed_memory_policy.h" |
30 #include "cc/output/output_surface_client.h" | 29 #include "cc/output/output_surface_client.h" |
31 #include "cc/output/renderer.h" | 30 #include "cc/output/renderer.h" |
32 #include "cc/quads/render_pass.h" | 31 #include "cc/quads/render_pass.h" |
| 32 #include "cc/resources/rasterizer.h" |
33 #include "cc/resources/resource_provider.h" | 33 #include "cc/resources/resource_provider.h" |
34 #include "cc/resources/tile_manager.h" | 34 #include "cc/resources/tile_manager.h" |
35 #include "cc/scheduler/commit_earlyout_reason.h" | 35 #include "cc/scheduler/commit_earlyout_reason.h" |
36 #include "cc/scheduler/draw_result.h" | 36 #include "cc/scheduler/draw_result.h" |
37 #include "skia/ext/refptr.h" | 37 #include "skia/ext/refptr.h" |
38 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
39 #include "ui/gfx/geometry/rect.h" | 39 #include "ui/gfx/geometry/rect.h" |
40 | 40 |
41 namespace cc { | 41 namespace cc { |
42 | 42 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 void GetPictureLayerImplPairs(std::vector<PictureLayerImpl::Pair>* layers, | 493 void GetPictureLayerImplPairs(std::vector<PictureLayerImpl::Pair>* layers, |
494 bool need_valid_tile_priorities) const; | 494 bool need_valid_tile_priorities) const; |
495 | 495 |
496 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } | 496 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } |
497 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } | 497 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } |
498 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } | 498 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } |
499 | 499 |
500 // Only valid for synchronous (non-scheduled) single-threaded case. | 500 // Only valid for synchronous (non-scheduled) single-threaded case. |
501 void SynchronouslyInitializeAllTiles(); | 501 void SynchronouslyInitializeAllTiles(); |
502 | 502 |
| 503 virtual scoped_ptr<Rasterizer> CreateRasterizer(); |
503 virtual void CreateResourceAndTileTaskWorkerPool( | 504 virtual void CreateResourceAndTileTaskWorkerPool( |
504 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 505 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
505 scoped_ptr<ResourcePool>* resource_pool, | 506 scoped_ptr<ResourcePool>* resource_pool, |
506 scoped_ptr<ResourcePool>* staging_resource_pool); | 507 scoped_ptr<ResourcePool>* staging_resource_pool); |
507 | 508 |
| 509 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
| 510 |
508 protected: | 511 protected: |
509 LayerTreeHostImpl( | 512 LayerTreeHostImpl( |
510 const LayerTreeSettings& settings, | 513 const LayerTreeSettings& settings, |
511 LayerTreeHostImplClient* client, | 514 LayerTreeHostImplClient* client, |
512 Proxy* proxy, | 515 Proxy* proxy, |
513 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 516 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
514 SharedBitmapManager* shared_bitmap_manager, | 517 SharedBitmapManager* shared_bitmap_manager, |
515 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 518 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
516 int id); | 519 int id); |
517 | 520 |
518 void UpdateViewportContainerSizes(); | 521 void UpdateViewportContainerSizes(); |
519 | 522 |
520 // Virtual for testing. | 523 // Virtual for testing. |
521 virtual void AnimateLayers(base::TimeTicks monotonic_time); | 524 virtual void AnimateLayers(base::TimeTicks monotonic_time); |
522 const AnimationRegistrar::AnimationControllerMap& | 525 const AnimationRegistrar::AnimationControllerMap& |
523 active_animation_controllers() const { | 526 active_animation_controllers() const { |
524 return animation_registrar_->active_animation_controllers(); | 527 return animation_registrar_->active_animation_controllers(); |
525 } | 528 } |
526 | 529 |
527 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } | |
528 | |
529 LayerTreeHostImplClient* client_; | 530 LayerTreeHostImplClient* client_; |
530 Proxy* proxy_; | 531 Proxy* proxy_; |
531 | 532 |
532 private: | 533 private: |
533 void CreateAndSetRenderer(); | 534 void CreateAndSetRenderer(); |
534 void CreateAndSetTileManager(); | 535 void CreateAndSetTileManager(); |
535 void DestroyTileManager(); | 536 void DestroyTileManager(); |
536 void ReleaseTreeResources(); | 537 void ReleaseTreeResources(); |
537 void EnforceZeroBudget(bool zero_budget); | 538 void EnforceZeroBudget(bool zero_budget); |
538 | 539 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 606 |
606 scoped_ptr<OutputSurface> output_surface_; | 607 scoped_ptr<OutputSurface> output_surface_; |
607 | 608 |
608 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 609 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
609 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 610 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
610 scoped_ptr<ResourceProvider> resource_provider_; | 611 scoped_ptr<ResourceProvider> resource_provider_; |
611 scoped_ptr<TileManager> tile_manager_; | 612 scoped_ptr<TileManager> tile_manager_; |
612 bool use_gpu_rasterization_; | 613 bool use_gpu_rasterization_; |
613 GpuRasterizationStatus gpu_rasterization_status_; | 614 GpuRasterizationStatus gpu_rasterization_status_; |
614 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; | 615 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; |
| 616 scoped_ptr<Rasterizer> rasterizer_; |
615 scoped_ptr<ResourcePool> resource_pool_; | 617 scoped_ptr<ResourcePool> resource_pool_; |
616 scoped_ptr<ResourcePool> staging_resource_pool_; | 618 scoped_ptr<ResourcePool> staging_resource_pool_; |
617 scoped_ptr<Renderer> renderer_; | 619 scoped_ptr<Renderer> renderer_; |
618 | 620 |
619 GlobalStateThatImpactsTilePriority global_tile_state_; | 621 GlobalStateThatImpactsTilePriority global_tile_state_; |
620 | 622 |
621 // Tree currently being drawn. | 623 // Tree currently being drawn. |
622 scoped_ptr<LayerTreeImpl> active_tree_; | 624 scoped_ptr<LayerTreeImpl> active_tree_; |
623 | 625 |
624 // In impl-side painting mode, tree with possibly incomplete rasterized | 626 // In impl-side painting mode, tree with possibly incomplete rasterized |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 729 |
728 bool requires_high_res_to_draw_; | 730 bool requires_high_res_to_draw_; |
729 bool required_for_draw_tile_is_top_of_raster_queue_; | 731 bool required_for_draw_tile_is_top_of_raster_queue_; |
730 | 732 |
731 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 733 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
732 }; | 734 }; |
733 | 735 |
734 } // namespace cc | 736 } // namespace cc |
735 | 737 |
736 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 738 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |